• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QAccessibleEvent

    下一话题

    QDragMoveEvent

    QDropEvent

    继承者: QDragMoveEvent , QDragEnterEvent

    详细描述

    PySide.QtGui.QDropEvent class provides an event which is sent when a drag and drop action is completed.

    当 Widget accepts drop events ,将接收此事件若它有接受最近 PySide.QtGui.QDragEnterEvent or PySide.QtGui.QDragMoveEvent 发送给它的。

    掉落事件包含提议动作,可获得自 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 值,选择这些值之一作为默认动作或询问用户以选择其首选动作,可能是有用的。

    若提议掉落动作不适合,或许因为自定义 Widget 不支持该动作,可以将其替换为任何 possible drop actions 通过调用 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() 而不是 PySide.QtGui.QDropEvent.acceptProposedAction() to complete the drop operation.

    PySide.QtGui.QDropEvent.mimeData() function provides the data dropped on the widget in a PySide.QtCore.QMimeData 对象。这包含数据 MIME 类型的有关信息,除数据本身外。

    class PySide.QtGui. QDropEvent ( pos , actions , data , buttons , modifiers [ , type=Drop ] )
    参数:
    PySide.QtGui.QDropEvent. acceptProposedAction ( )

    把拖曳运转设为提议动作。

    PySide.QtGui.QDropEvent. dropAction ( )
    返回类型: 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.

    PySide.QtGui.QDropEvent. keyboardModifiers ( )
    返回类型: PySide.QtCore.Qt.KeyboardModifiers

    返回被按下的修饰符键。

    PySide.QtGui.QDropEvent. mimeData ( )
    返回类型: PySide.QtCore.QMimeData

    返回掉落在 Widget 上的数据及其关联 MIME 类型信息。

    PySide.QtGui.QDropEvent. mouseButtons ( )
    返回类型: PySide.QtCore.Qt.MouseButtons

    Returns the mouse buttons that are pressed..

    PySide.QtGui.QDropEvent. pos ( )
    返回类型: PySide.QtCore.QPoint

    返回掉落点位置。

    PySide.QtGui.QDropEvent. possibleActions ( )
    返回类型: PySide.QtCore.Qt.DropActions

    返回可能掉落动作的 OR 组合。

    PySide.QtGui.QDropEvent. proposedAction ( )
    返回类型: PySide.QtCore.Qt.DropAction

    返回提议掉落动作。

    PySide.QtGui.QDropEvent. setDropAction ( action )
    参数: action PySide.QtCore.Qt.DropAction
    PySide.QtGui.QDropEvent. source ( )
    返回类型: 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.

    另请参阅

    QDrag.QDrag()