QGraphicsSceneDragDropEventclass provides events for drag and drop in the graphics view framework. 更多 …
def
acceptProposedAction
()
def
buttons
()
def
dropAction
()
def
mimeData
()
def
modifiers
()
def
pos
()
def
possibleActions
()
def
proposedAction
()
def
scenePos
()
def
screenPos
()
def
setButtons
(buttons)
def
setDropAction
(action)
def
setModifiers
(modifiers)
def
setPos
(pos)
def
setPossibleActions
(actions)
def
setProposedAction
(action)
def
setScenePos
(pos)
def
setScreenPos
(pos)
def
source
()
QGraphicsViewinherits the drag and drop functionality provided byQWidget. When it receives a drag and drop event, it translates it to aQGraphicsSceneDragDropEvent.
QGraphicsSceneDragDropEventstores events of typeGraphicsSceneDragEnter,GraphicsSceneDragLeave,GraphicsSceneDragMove,或GraphicsSceneDrop.
QGraphicsSceneDragDropEventcontains the position of the mouse cursor in both item, scene, and screen coordinates; this can be retrieved withpos(),scenePos(),和screenPos().The scene sends the event to the first
QGraphicsItemunder the mouse cursor that accepts drops; a graphics item is set to accept drops withsetAcceptDrops().
QGraphicsSceneDragDropEvent
(
[
type=None
]
)
¶
- param type
Type
构造新
QGraphicsSceneDragDropEvent
的指定
type
. The type can be either
GraphicsSceneDragEnter
,
GraphicsSceneDragLeave
,
GraphicsSceneDragMove
,或
GraphicsSceneDrop
.
PySide2.QtWidgets.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()
.
MouseButtons
返回
MouseButtons
value indicating which buttons were pressed on the mouse when this mouse event was generated.
另请参阅
MouseButtons
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
dropAction
(
)
¶
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
exec()
.
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
mimeData
(
)
¶
QMimeData
This function returns the MIME data of the event.
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
modifiers
(
)
¶
KeyboardModifiers
Returns the keyboard modifiers that were pressed when the drag and drop event was created.
另请参阅
KeyboardModifiers
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
pos
(
)
¶
QPointF
Returns the mouse position of the event relative to the view that sent the event.
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
possibleActions
(
)
¶
DropActions
Returns the possible drop actions that the drag and drop can result in.
另请参阅
DropActions
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
proposedAction
(
)
¶
DropAction
Returns the drop action that is proposed, i.e., preferred. The action must be one of the possible actions as defined by
possibleActions()
.
另请参阅
DropAction
possibleActions()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
scenePos
(
)
¶
QPointF
Returns the position of the mouse in scene coordinates.
另请参阅
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
screenPos
(
)
¶
QPoint
Returns the position of the mouse relative to the screen.
另请参阅
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setButtons
(
buttons
)
¶
buttons
–
MouseButtons
Sets the mouse buttons that were pressed when the event was created to
buttons
.
另请参阅
MouseButtons
buttons()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setDropAction
(
action
)
¶
action
–
DropAction
This function lets the receiver of the drop set the drop action that was performed to
action
, which should be one of the
possible
actions
。调用
accept()
in stead of
acceptProposedAction()
if you use this function.
另请参阅
dropAction()
accept()
possibleActions()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setModifiers
(
modifiers
)
¶
modifiers
–
KeyboardModifiers
Sets the keyboard modifiers that were pressed when the event was created to
modifiers
.
另请参阅
KeyboardModifiers
modifiers()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setPos
(
pos
)
¶
pos
–
QPointF
Sets the position of the mouse to
pos
; this should be relative to the widget that generated the event, which normally is a
QGraphicsView
.
另请参阅
pos()
setScenePos()setScreenPos()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setPossibleActions
(
actions
)
¶
actions
–
DropActions
Sets the possible drop actions that the drag can result in to
actions
.
另请参阅
DropActions
possibleActions()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setProposedAction
(
action
)
¶
action
–
DropAction
Sets the proposed action to
action
. The proposed action is a
DropAction
that is one of the possible actions as given by
possibleActions()
.
另请参阅
proposedAction()
DropAction
possibleActions()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setScenePos
(
pos
)
¶
pos
–
QPointF
Sets the scene position of the mouse to
pos
.
另请参阅
scenePos()
setScreenPos()setPos()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
setScreenPos
(
pos
)
¶
pos
–
QPoint
Sets the mouse position relative to the screen to
pos
.
另请参阅
screenPos()
setScenePos()setPos()
PySide2.QtWidgets.QGraphicsSceneDragDropEvent.
source
(
)
¶
This function returns the
QGraphicsView
that created the
QGraphicsSceneDragDropEvent
.