The PySide.QtGui.QDropEvent class provides an event which is sent when a drag and drop action is completed.
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.
Sets the drop action to be the proposed action.
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.
Returns the modifier keys that are pressed.
Returns the data that was dropped on the widget and its associated MIME type information.
Returns the mouse buttons that are pressed..
Returns the position where the drop was made.
Returns an OR-combination of possible drop actions.
Returns the proposed drop action.
|Parameters:||action – PySide.QtCore.Qt.DropAction|
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.