Inherited by: QDragMoveEvent, QDragEnterEvent
The PySide.QtGui.QDropEvent class provides an event which is sent when a drag and drop action is completed.
When a widget accepts drop events , it will receive this event if it has accepted the most recent PySide.QtGui.QDragEnterEvent or PySide.QtGui.QDragMoveEvent sent to it.
The drop event contains a proposed action, available from PySide.QtGui.QDropEvent.proposedAction() , for the widget to either accept or ignore. If the action can be handled by the widget, you should call the PySide.QtGui.QDropEvent.acceptProposedAction() function. Since the proposed action can be a combination of Qt.DropAction values, it may be useful to either select one of these values as a default action or ask the user to select their preferred action.
If the proposed drop action is not suitable, perhaps because your custom widget does not support that action, you can replace it with any of the possible drop actions by calling PySide.QtGui.QDropEvent.setDropAction() with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned by PySide.QtGui.QDropEvent.possibleActions() , the default copy action will be used. Once a replacement drop action has been set, call PySide.QtCore.QEvent.accept() instead of PySide.QtGui.QDropEvent.acceptProposedAction() to complete the drop operation.
The PySide.QtGui.QDropEvent.mimeData() function provides the data dropped on the widget in a PySide.QtCore.QMimeData object. This contains information about the MIME type of the data in addition to the data itself.
See also
PySide.QtCore.QMimeData PySide.QtGui.QDrag Drag and Drop
Parameters: |
|
---|
Sets the drop action to be the proposed action.
See also
PySide.QtGui.QDropEvent.setDropAction() PySide.QtGui.QDropEvent.proposedAction() PySide.QtCore.QEvent.accept()
Return type: | PySide.QtCore.Qt.DropAction |
---|
Returns the action to be performed on the data by the target. This may be different from the action supplied in PySide.QtGui.QDropEvent.proposedAction() if you have called PySide.QtGui.QDropEvent.setDropAction() to explicitly choose a drop action.
Return type: | PySide.QtCore.Qt.KeyboardModifiers |
---|
Returns the modifier keys that are pressed.
Return type: | PySide.QtCore.QMimeData |
---|
Returns the data that was dropped on the widget and its associated MIME type information.
Return type: | PySide.QtCore.Qt.MouseButtons |
---|
Returns the mouse buttons that are pressed..
Return type: | PySide.QtCore.QPoint |
---|
Returns the position where the drop was made.
Return type: | PySide.QtCore.Qt.DropActions |
---|
Returns an OR-combination of possible drop actions.
See also
Return type: | PySide.QtCore.Qt.DropAction |
---|
Returns the proposed drop action.
See also
Parameters: | action – PySide.QtCore.Qt.DropAction |
---|
Return type: | PySide.QtGui.QWidget |
---|
If the source of the drag operation is a widget in this application, this function returns that source; otherwise it returns 0. The source of the operation is the first parameter to the PySide.QtGui.QDrag object used instantiate the drag.
This is useful if your widget needs special behavior when dragging to itself.
See also
QDrag.QDrag()