QDragEnterEvent Class

QDragEnterEvent 类提供了一个事件,当拖放操作进入一个部件时,该事件将被发送到该部件。更多

头文件: #include <QDragEnterEvent>
CMake.QDragEnterEvent 类 find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
继承: QDragMoveEvent

公共函数

QDragEnterEvent(const QPoint &point, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)

详细说明

部件必须接受此事件,才能接收拖放操作过程中发送的drag move events 。拖动输入事件之后总是紧接着一个拖动移动事件。

QDragEnterEvent 的大部分功能继承自QDragMoveEvent ,而 的大部分功能又继承自QDropEvent

另请参见 QDragLeaveEventQDragMoveEventQDropEvent

成员函数文档

QDragEnterEvent::QDragEnterEvent(const QPoint &point, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)

构造一个 QDragEnterEvent(拖入事件),该事件表示拖动进入给定point 的部件,鼠标和键盘状态由buttonsmodifiers 指定。

拖动数据以data 中的 MIME 编码信息形式传递,指定的actions 描述了可执行的拖放操作的可能类型。

警告: 请勿自行创建 QDragEnterEvent,因为这些对象依赖于 Qt 的内部状态。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.