QGraphicsSceneContextMenuEvent Class

The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework. 更多...

头文件: #include <QGraphicsSceneContextMenuEvent>
qmake: QT += widgets
开始支持版本: Qt 4.2
基类: QGraphicsSceneEvent

公有类型

enum Reason { Mouse, Keyboard, Other }

公有函数

~QGraphicsSceneContextMenuEvent()
Qt::KeyboardModifiers modifiers() const
QPointF pos() const
Reason reason() const
QPointF scenePos() const
QPoint screenPos() const

其他继承的成员

  • 1 个属性继承自 QEvent
  • 1 个静态公有成员继承自 QEvent
  • 2 个受保护的变量继承自 QEvent

详细描述

The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework.

A QContextMenuEvent received by a QGraphicsView is translated into a QGraphicsSceneContextMenuEvent. The QContextMenuEvent::globalPos() is translated into item, scene, and screen coordinates (pos(), scenePos(), and screenPos()).

参见 QGraphicsSceneMouseEvent, QGraphicsSceneWheelEvent, and QContextMenuEvent.

成员类型

enum QGraphicsSceneContextMenuEvent::Reason

This enum describes the reason why the context event was sent.

ConstantValueDescription
QGraphicsSceneContextMenuEvent::Mouse0The mouse caused the event to be sent. On most platforms, this means the right mouse button was clicked.
QGraphicsSceneContextMenuEvent::Keyboard1The keyboard caused this event to be sent. On Windows and macOS, this means the menu button was pressed.
QGraphicsSceneContextMenuEvent::Other2The event was sent by some other means (i.e. not by the mouse or keyboard).

成员函数

QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent()

Destroys the event.

Qt::KeyboardModifiers QGraphicsSceneContextMenuEvent::modifiers() const

Returns the keyboard modifiers in use when the context menu was requested.

QPointF QGraphicsSceneContextMenuEvent::pos() const

Returns the position of the mouse cursor in item coordinates at the moment the context menu was requested.

参见 scenePos() and screenPos().

Reason QGraphicsSceneContextMenuEvent::reason() const

Returns the reason for the context menu event.

参见 QGraphicsSceneContextMenuEvent::Reason.

QPointF QGraphicsSceneContextMenuEvent::scenePos() const

Returns the position of the mouse cursor in scene coordinates at the moment the context menu was requested.

参见 pos() and screenPos().

QPoint QGraphicsSceneContextMenuEvent::screenPos() const

Returns the position of the mouse cursor in screen coordinates at the moment the context menu was requested.

参见 pos() and scenePos().