QGraphicsSceneEvent Class
QGraphicsSceneEvent クラスは、グラフィックスビューに関連するすべてのイベントの基底クラスを提供します。詳細...
| ヘッダー: | #include <QGraphicsSceneEvent> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 継承元: | QEvent |
| 継承元: | QGraphicsSceneContextMenuEvent、QGraphicsSceneDragDropEvent 、QGraphicsSceneHelpEvent 、QGraphicsSceneHoverEvent 、QGraphicsSceneMouseEvent 、QGraphicsSceneMoveEvent 、QGraphicsSceneResizeEvent 、およびQGraphicsSceneWheelEvent |
パブリック関数
| virtual | ~QGraphicsSceneEvent() |
(since 6.2) quint64 | timestamp() const |
| QWidget * | widget() const |
詳細な説明
QGraphicsView が Qt のマウス、キーボード、およびドラッグ&ドロップイベント(QMouseEvent 、QKeyEvent 、QDragEvent など)を受信すると、それらを QGraphicsSceneEvent のサブクラスのインスタンスに変換し、表示しているQGraphicsScene に転送します。その後、シーンはイベントを関連するアイテムに転送します。
例えば、QGraphicsView がユーザーのクリックに応答してMousePress型のQMouseEvent を受信すると、そのビューはmousePressEvent()関数を通じて、基盤となるQGraphicsScene にGraphicsSceneMousePress型のQGraphicsSceneMouseEvent を送信します。QGraphicsScene::mousePressEvent()のデフォルトの実装は、どのアイテムがクリックされたかを判定し、そのイベントをQGraphicsItem::mousePressEvent()に転送します。
QGraphicsSceneMouseEvent やQGraphicsSceneContextMenuEvent などのサブクラスは、元のQEvent からの座標を、画面座標、シーン座標、およびアイテム座標として提供します(screenPos()、scenePos()、およびpos()を参照)。 アイテム座標は、QGraphicsScene がイベントをQGraphicsItem に転送する前に設定されます。また、マウスイベントでは、ビューが最後に受信したイベントの座標を取得することも可能です(lastScreenPos()、lastScenePos()、およびlastPos()を参照)。
QEventも参照してください 。
メンバ関数のドキュメント
[virtual noexcept] QGraphicsSceneEvent::~QGraphicsSceneEvent()
イベントを削除します。
[since 6.2] quint64 QGraphicsSceneEvent::timestamp() const
元のイベントのタイムスタンプを返します。元のイベントがタイムスタンプを報告していない場合は 0 を返します。
この関数は Qt 6.2 で導入されました。
QWidget *QGraphicsSceneEvent::widget() const
イベントの発生元となったウィジェットを返します。イベントが別のアプリケーションから発生した場合は、nullptr を返します。
© 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.