QGraphicsSceneDragDropEvent

Synopsis

Functions

Detailed Description

The PySide.QtGui.QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framework.

PySide.QtGui.QGraphicsView inherits the drag and drop functionality provided by PySide.QtGui.QWidget . When it receives a drag and drop event, it translates it to a PySide.QtGui.QGraphicsSceneDragDropEvent .

PySide.QtGui.QGraphicsSceneDragDropEvent stores events of type GraphicsSceneDragEnter , GraphicsSceneDragLeave , GraphicsSceneDragMove , or GraphicsSceneDrop .

PySide.QtGui.QGraphicsSceneDragDropEvent contains the position of the mouse cursor in both item, scene, and screen coordinates; this can be retrieved with PySide.QtGui.QGraphicsSceneDragDropEvent.pos() , PySide.QtGui.QGraphicsSceneDragDropEvent.scenePos() , and PySide.QtGui.QGraphicsSceneDragDropEvent.screenPos() .

The scene sends the event to the first PySide.QtGui.QGraphicsItem under the mouse cursor that accepts drops; a graphics item is set to accept drops with PySide.QtGui.QGraphicsItem.setAcceptDrops() .

class PySide.QtGui.QGraphicsSceneDragDropEvent([type=None])
Parameters:typePySide.QtCore.QEvent.Type

Constructs a new PySide.QtGui.QGraphicsSceneDragDropEvent of the specified type . The type can be either QEvent.GraphicsSceneDragEnter , QEvent.GraphicsSceneDragLeave , QEvent.GraphicsSceneDragMove , or QEvent.GraphicsSceneDrop .

PySide.QtGui.QGraphicsSceneDragDropEvent.acceptProposedAction()

Sets the proposed action as accepted, i.e, the drop action is set to the proposed action. This is equal to:

setDropAction(proposedAction())

When using this function, one should not call accept() .

PySide.QtGui.QGraphicsSceneDragDropEvent.buttons()
Return type:PySide.QtCore.Qt.MouseButtons

Returns a Qt.MouseButtons value indicating which buttons were pressed on the mouse when this mouse event was generated.

See also

Qt.MouseButtons

PySide.QtGui.QGraphicsSceneDragDropEvent.dropAction()
Return type:PySide.QtCore.Qt.DropAction

Returns the action that was performed in this drag and drop. This should be set by the receiver of the drop and is returned by QDrag.exec() .

PySide.QtGui.QGraphicsSceneDragDropEvent.mimeData()
Return type:PySide.QtCore.QMimeData

This function returns the MIME data of the event.

PySide.QtGui.QGraphicsSceneDragDropEvent.modifiers()
Return type:PySide.QtCore.Qt.KeyboardModifiers

Returns the keyboard modifiers that were pressed when the drag and drop event was created.

See also

Qt.KeyboardModifiers

PySide.QtGui.QGraphicsSceneDragDropEvent.pos()
Return type:PySide.QtCore.QPointF

Returns the mouse position of the event relative to the view that sent the event.

PySide.QtGui.QGraphicsSceneDragDropEvent.possibleActions()
Return type:PySide.QtCore.Qt.DropActions

Returns the possible drop actions that the drag and drop can result in.

See also

Qt.DropActions

PySide.QtGui.QGraphicsSceneDragDropEvent.proposedAction()
Return type:PySide.QtCore.Qt.DropAction

Returns the drop action that is proposed, i.e., preferred. The action must be one of the possible actions as defined by possibleActions() .

PySide.QtGui.QGraphicsSceneDragDropEvent.scenePos()
Return type:PySide.QtCore.QPointF

Returns the position of the mouse in scene coordinates.

PySide.QtGui.QGraphicsSceneDragDropEvent.screenPos()
Return type:PySide.QtCore.QPoint

Returns the position of the mouse relative to the screen.

PySide.QtGui.QGraphicsSceneDragDropEvent.setButtons(buttons)
Parameters:buttonsPySide.QtCore.Qt.MouseButtons
PySide.QtGui.QGraphicsSceneDragDropEvent.setDropAction(action)
Parameters:actionPySide.QtCore.Qt.DropAction
PySide.QtGui.QGraphicsSceneDragDropEvent.setModifiers(modifiers)
Parameters:modifiersPySide.QtCore.Qt.KeyboardModifiers
PySide.QtGui.QGraphicsSceneDragDropEvent.setPos(pos)
Parameters:posPySide.QtCore.QPointF

Sets the position of the mouse to pos ; this should be relative to the widget that generated the event, which normally is a PySide.QtGui.QGraphicsView .

PySide.QtGui.QGraphicsSceneDragDropEvent.setPossibleActions(actions)
Parameters:actionsPySide.QtCore.Qt.DropActions
PySide.QtGui.QGraphicsSceneDragDropEvent.setProposedAction(action)
Parameters:actionPySide.QtCore.Qt.DropAction
PySide.QtGui.QGraphicsSceneDragDropEvent.setScenePos(pos)
Parameters:posPySide.QtCore.QPointF

Sets the scene position of the mouse to pos .

PySide.QtGui.QGraphicsSceneDragDropEvent.setScreenPos(pos)
Parameters:posPySide.QtCore.QPoint

Sets the mouse position relative to the screen to pos .

PySide.QtGui.QGraphicsSceneDragDropEvent.source()
Return type:PySide.QtGui.QWidget

This function returns the PySide.QtGui.QGraphicsView that created the PySide.QtGui.QGraphicsSceneDragDropEvent .