QDropEventclass provides an event which is sent when a drag and drop action is completed. 更多 …
继承者: QDragEnterEvent , QDragMoveEvent
def
acceptProposedAction
()
def
dropAction
()
def
keyboardModifiers
()
def
mimeData
()
def
mouseButtons
()
def
pos
()
def
posF
()
def
possibleActions
()
def
proposedAction
()
def
setDropAction
(action)
def
source
()
当 Widget
accepts drop events,将接收此事件若它有接受最近QDragEnterEventorQDragMoveEvent发送给它的。掉落事件包含提议动作,可获得自
proposedAction(), for the widget to either accept or ignore. If the action can be handled by the widget, you should call theacceptProposedAction()function. Since the proposed action can be a combination ofDropAction值,选择这些值之一作为默认动作或询问用户以选择其首选动作,可能是有用的。若提议掉落动作不适合,或许因为自定义 Widget 不支持该动作,可以将其替换为任何
possible drop actions通过调用setDropAction()with your preferred action. If you set a value that is not present in the bitwise OR combination of values returned bypossibleActions(), the default copy action will be used. Once a replacement drop action has been set, callaccept()而不是acceptProposedAction()to complete the drop operation.
mimeData()function provides the data dropped on the widget in aQMimeData对象。这包含数据 MIME 类型的有关信息,除数据本身外。
QDropEvent
(
pos
,
actions
,
data
,
buttons
,
modifiers
[
,
type=Drop
]
)
¶
- param type
Type- param modifiers
KeyboardModifiers- param actions
DropActions- param buttons
MouseButtons- param pos
QPointF- param data
QMimeData
Constructs a drop event of a certain
type
corresponding to a drop at the point specified by
pos
in the destination widget’s coordinate system.
actions
indicate which types of drag and drop operation can be performed, and the drag data is stored as MIME-encoded data in
data
.
The states of the mouse buttons and keyboard modifiers at the time of the drop are specified by
buttons
and
modifiers
.
PySide2.QtGui.QDropEvent.
acceptProposedAction
(
)
¶
把拖曳运转设为提议动作。
另请参阅
setDropAction()
proposedAction()
accept()
PySide2.QtGui.QDropEvent.
dropAction
(
)
¶
DropAction
Returns the action to be performed on the data by the target. This may be different from the action supplied in
proposedAction()
if you have called
setDropAction()
to explicitly choose a drop action.
另请参阅
PySide2.QtGui.QDropEvent.
keyboardModifiers
(
)
¶
KeyboardModifiers
返回被按下的修饰符键。
PySide2.QtGui.QDropEvent.
mimeData
(
)
¶
QMimeData
返回掉落在 Widget 上的数据及其关联 MIME 类型信息。
PySide2.QtGui.QDropEvent.
mouseButtons
(
)
¶
MouseButtons
Returns the mouse buttons that are pressed..
PySide2.QtGui.QDropEvent.
pos
(
)
¶
QPoint
返回掉落点位置。
PySide2.QtGui.QDropEvent.
posF
(
)
¶
QPointF
返回掉落点位置。
PySide2.QtGui.QDropEvent.
possibleActions
(
)
¶
DropActions
返回可能掉落动作的 OR 组合。
另请参阅
PySide2.QtGui.QDropEvent.
proposedAction
(
)
¶
DropAction
返回提议掉落动作。
另请参阅
PySide2.QtGui.QDropEvent.
setDropAction
(
action
)
¶
action
–
DropAction
设置
action
以由目标履行数据。使用这以覆盖
proposed
action
采用某一
possible
actions
.
若设置的掉落动作不是可能的动作之一,拖放操作将默认为拷贝操作。
一旦提供置换掉落动作,就可调用
accept()
而不是
acceptProposedAction()
.
另请参阅
PySide2.QtGui.QDropEvent.
source
(
)
¶
QObject
If the source of the drag operation is a widget in this application, this function returns that source; otherwise it returns
None
. The source of the operation is the first parameter to the
QDrag
object used instantiate the drag.
This is useful if your widget needs special behavior when dragging to itself.
另请参阅
QDrag()