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

    上一话题

    QTouchEvent.TouchPoint

    下一话题

    QDrag

    QContextMenuEvent

    概要

    函数

    详细描述

    PySide.QtGui.QContextMenuEvent class contains parameters that describe a context menu event.

    Context menu events are sent to widgets when a user performs an action associated with opening a context menu. The actions required to open context menus vary between platforms; for example, on Windows, pressing the menu button or clicking the right mouse button will cause this event to be sent.

    当此事件发生时,通常展示 PySide.QtGui.QMenu 带上下文菜单,若这与上下文有关。

    Context menu events contain a special accept flag that indicates whether the receiver accepted the event. If the event handler does not accept the event then, if possible, whatever triggered the event will be handled as a regular input event.

    class PySide.QtGui. QContextMenuEvent ( reason , pos )
    class PySide.QtGui. QContextMenuEvent ( reason , pos , globalPos )
    class PySide.QtGui. QContextMenuEvent ( reason , pos , globalPos , modifiers )
    参数:

    Constructs a context menu event object with the accept parameter flag set to false.

    reason 参数必须是 QContextMenuEvent.Mouse or QContextMenuEvent.Keyboard .

    pos parameter specifies the mouse position relative to the receiving widget.

    PySide.QtGui.QContextMenuEvent.globalPos() is initialized to QCursor.pos() , which may not be appropriate. Use the other constructor to specify the global position explicitly.

    Constructs a context menu event object with the accept parameter flag set to false.

    reason 参数必须是 QContextMenuEvent.Mouse or QContextMenuEvent.Keyboard .

    pos parameter specifies the mouse position relative to the receiving widget. globalPos is the mouse position in absolute coordinates.

    PySide.QtGui.QContextMenuEvent. Reason

    此枚举描述事件为什么被发送的原因。

    常量 描述
    QContextMenuEvent.Mouse The mouse caused the event to be sent. Normally this means the right mouse button was clicked, but this is platform dependent.
    QContextMenuEvent.Keyboard The keyboard caused this event to be sent. On Windows, this means the menu button was pressed.
    QContextMenuEvent.Other The event was sent by some other means (i.e. not by the mouse or keyboard).
    PySide.QtGui.QContextMenuEvent. globalPos ( )
    返回类型: PySide.QtCore.QPoint

    Returns the global position of the mouse pointer at the time of the event.

    PySide.QtGui.QContextMenuEvent. globalX ( )
    返回类型: PySide.QtCore.int

    返回事件发生时鼠标指针的全局 x 位置。

    PySide.QtGui.QContextMenuEvent. globalY ( )
    返回类型: PySide.QtCore.int

    Returns the global y position of the mouse pointer at the time of the event.

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

    Returns the position of the mouse pointer relative to the widget that received the event.

    PySide.QtGui.QContextMenuEvent. reason ( )
    返回类型: PySide.QtGui.QContextMenuEvent.Reason

    Returns the reason for this context event.

    PySide.QtGui.QContextMenuEvent. x ( )
    返回类型: PySide.QtCore.int

    Returns the x position of the mouse pointer, relative to the widget that received the event.

    PySide.QtGui.QContextMenuEvent. y ( )
    返回类型: PySide.QtCore.int

    Returns the y position of the mouse pointer, relative to the widget that received the event.