The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress. More...
|CMake:|| find_package(Qt6 REQUIRED COMPONENTS Gui) |
target_link_libraries(mytarget PRIVATE Qt6::Gui)
|qmake:||QT += gui|
- List of all members, including inherited members
- QDragMoveEvent is part of Event Classes and draganddrop.
|QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = DragMove)|
|void||accept(const QRect &rectangle)|
|void||ignore(const QRect &rectangle)|
|virtual QDragMoveEvent *||clone() const override|
|QDragMoveEvent(const QDragMoveEvent &)|
|QDragMoveEvent &||operator=(const QDragMoveEvent &other)|
|QDragMoveEvent &||operator=(QDragMoveEvent &&)|
A widget will receive drag move events repeatedly while the drag is within its boundaries, if it accepts drop events and enter events. The widget should examine the event to see what kind of data it provides, and call the accept() function to accept the drop if appropriate.
The rectangle supplied by the answerRect() function can be used to restrict drops to certain parts of the widget. For example, we can check whether the rectangle intersects with the geometry of a certain child widget and only call acceptProposedAction() if that is the case.
Note that this class inherits most of its functionality from QDropEvent.
Member Function Documentation
[protected] QDragMoveEvent::QDragMoveEvent(const QDragMoveEvent &)
Default constructs an instance of QDragMoveEvent.
[protected] QDragMoveEvent::QDragMoveEvent(QDragMoveEvent &&)
QDragMoveEvent::QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = DragMove)
Creates a QDragMoveEvent of the required type indicating that the mouse is at position pos given within a widget.
The mouse and keyboard states are specified by buttons and modifiers, and the actions describe the types of drag and drop operation that are possible. The drag data is passed as MIME-encoded information in data.
Warning: Do not attempt to create a QDragMoveEvent yourself. These objects rely on Qt's internal state.
Destroys the instance of QDragMoveEvent. The destructor is virtual.
void QDragMoveEvent::accept(const QRect &rectangle)
The same as accept(), but also notifies that future moves will also be acceptable if they remain within the rectangle given on the widget. This can improve performance, but may also be ignored by the underlying system.
If the rectangle is empty, drag move events will be sent continuously. This is useful if the source is scrolling in a timer event.
This is an overloaded function.
QRect QDragMoveEvent::answerRect() const
Returns the rectangle in the widget where the drop will occur if accepted. You can use this information to restrict drops to certain places on the widget.
[override virtual] QDragMoveEvent *QDragMoveEvent::clone() const
void QDragMoveEvent::ignore(const QRect &rectangle)
The opposite of the accept(const QRect&) function. Moves within the rectangle are not acceptable, and will be ignored.
This is an overloaded function.
[protected] QDragMoveEvent &QDragMoveEvent::operator=(const QDragMoveEvent &other)
[protected] QDragMoveEvent &QDragMoveEvent::operator=(QDragMoveEvent &&)
Member Variable Documentation
© 2022 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.