このページでは

QGraphicsSceneContextMenuEvent Class

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

詳細な説明

QGraphicsView が受信した `QContextMenuEvent ` は、`QGraphicsSceneContextMenuEvent` に変換されます。`QContextMenuEvent::globalPos()` は、項目、シーン、および画面の座標(`pos()`、`scenePos()`、および `screenPos()`)に変換されます。

QGraphicsSceneMouseEvent 、QGraphicsSceneWheelEvent 、およびQContextMenuEventも参照してください 。

メンバ型のドキュメント

enum QGraphicsSceneContextMenuEvent::Reason

この列挙型は、コンテキストイベントが送信された理由を表します。

定数値説明
QGraphicsSceneContextMenuEvent::Mouse0マウスによってイベントが送信されました。ほとんどのプラットフォームでは、これはマウスの右ボタンがクリックされたことを意味します。
QGraphicsSceneContextMenuEvent::Keyboard1キーボードによってこのイベントが送信されました。Windows および macOS では、これはメニューボタンが押されたことを意味します。
QGraphicsSceneContextMenuEvent::Other2このイベントは、マウスやキーボード以外の何らかの手段によって送信されました。

メンバ関数のドキュメント

[virtual noexcept] QGraphicsSceneContextMenuEvent::~QGraphicsSceneContextMenuEvent()

イベントを破棄します。

Qt::KeyboardModifiers QGraphicsSceneContextMenuEvent::modifiers() const

コンテキストメニューが要求された時点で使用されていたキーボード修飾キーを返します。

QPointF QGraphicsSceneContextMenuEvent::pos() const

コンテキストメニューが要求された時点での、アイテム座標系におけるマウスカーソルの位置を返します。

scenePos() およびscreenPos()も参照してください 。

QGraphicsSceneContextMenuEvent::Reason QGraphicsSceneContextMenuEvent::reason() const

コンテキストメニューイベントの発生理由を返します。

「QGraphicsSceneContextMenuEvent::Reason」も参照してください 。

QPointF QGraphicsSceneContextMenuEvent::scenePos() const

コンテキストメニューが要求された時点での、シーン座標系におけるマウスカーソルの位置を返します。

pos() およびscreenPos()も参照してください 。

QPoint QGraphicsSceneContextMenuEvent::screenPos() const

コンテキストメニューが要求された時点での、画面座標におけるマウスカーソルの位置を返します。

pos() およびscenePos()も参照してください 。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.