QDragMoveEvent¶
The
QDragMoveEvent
class provides an event which is sent while a drag and drop action is in progress. More…
Inherited by: QDragEnterEvent
Synopsis¶
Functions¶
def
accept
()def
accept
(r)def
answerRect
()def
ignore
()def
ignore
(r)
Detailed Description¶
A widget will receive drag move events repeatedly while the drag is within its boundaries, if it accepts
drop events
andenter events
. The widget should examine the event to see what kind ofdata
it provides, and call theaccept()
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 callacceptProposedAction()
if that is the case.Note that this class inherits most of its functionality from
QDropEvent
.See also
- class PySide2.QtGui.QDragMoveEvent(pos, actions, data, buttons, modifiers[, type=DragMove])¶
- param type:
- param modifiers:
KeyboardModifiers
- param actions:
DropActions
- param buttons:
MouseButtons
- param pos:
- param data:
Creates a
QDragMoveEvent
of the requiredtype
indicating that the mouse is at positionpos
given within a widget.The mouse and keyboard states are specified by
buttons
andmodifiers
, and theactions
describe the types of drag and drop operation that are possible. The drag data is passed as MIME-encoded information indata
.Warning
Do not attempt to create a
QDragMoveEvent
yourself. These objects rely on Qt’s internal state.
- PySide2.QtGui.QDragMoveEvent.accept()¶
This is an overloaded function.
Calls
accept()
.
- PySide2.QtGui.QDragMoveEvent.accept(r)
- Parameters:
The same as
accept()
, but also notifies that future moves will also be acceptable if they remain within therectangle
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.
- PySide2.QtGui.QDragMoveEvent.answerRect()¶
- Return type:
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.
- PySide2.QtGui.QDragMoveEvent.ignore()¶
This is an overloaded function.
Calls
ignore()
.
- PySide2.QtGui.QDragMoveEvent.ignore(r)
- Parameters:
The opposite of the accept(const
QRect
&) function. Moves within therectangle
are not acceptable, and will be ignored.
© 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.