QGraphicsSceneContextMenuEvent 类在图形视图框架中提供上下文菜单事件。 更多...
头: | #include <QGraphicsSceneContextMenuEvent> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
继承: | QGraphicsSceneEvent |
enum | Reason { Mouse, Keyboard, Other } |
virtual | ~QGraphicsSceneContextMenuEvent () |
Qt::KeyboardModifiers | modifiers () const |
QPointF | pos () const |
QGraphicsSceneContextMenuEvent::Reason | reason () const |
QPointF | scenePos () const |
QPoint | screenPos () const |
A QContextMenuEvent 接收通过 QGraphicsView 被翻译成 QGraphicsSceneContextMenuEvent。 QContextMenuEvent::globalPos () 被翻译成项、场景及屏幕坐标 ( pos (), scenePos (),和 screenPos ()).
另请参阅 QGraphicsSceneMouseEvent , QGraphicsSceneWheelEvent ,和 QContextMenuEvent .
此枚举描述为什么发送上下文事件的原因。
常量 | 值 | 描述 |
---|---|---|
QGraphicsSceneContextMenuEvent::Mouse
|
0
|
The mouse caused the event to be sent. On most platforms, this means the right mouse button was clicked. |
QGraphicsSceneContextMenuEvent::Keyboard
|
1
|
The keyboard caused this event to be sent. On Windows and macOS, this means the menu button was pressed. |
QGraphicsSceneContextMenuEvent::Other
|
2
|
事件是通过某些其它手段发送的 (即:不通过鼠标或键盘)。 |
[virtual noexcept]
QGraphicsSceneContextMenuEvent::
~QGraphicsSceneContextMenuEvent
()
销毁事件。
Returns the keyboard modifiers in use when the context menu was requested.
Returns the position of the mouse cursor in item coordinates at the moment the context menu was requested.
另请参阅 scenePos () 和 screenPos ().
Returns the reason for the context menu event.
另请参阅 QGraphicsSceneContextMenuEvent::Reason .
Returns the position of the mouse cursor in scene coordinates at the moment the context menu was requested.
Returns the position of the mouse cursor in screen coordinates at the moment the context menu was requested.