QGraphicsSceneMouseEvent Class
QGraphicsSceneMouseEvent クラスは、グラフィックスビューフレームワークにおいてマウスイベントを提供します。詳細...
| ヘッダー: | #include <QGraphicsSceneMouseEvent> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 継承元: | QGraphicsSceneEvent |
パブリック関数
| virtual | ~QGraphicsSceneMouseEvent() |
| Qt::MouseButton | button() const |
| QPointF | buttonDownPos(Qt::MouseButton button) const |
| QPointF | buttonDownScenePos(Qt::MouseButton button) const |
| QPoint | buttonDownScreenPos(Qt::MouseButton button) const |
| Qt::MouseButtons | buttons() const |
| Qt::MouseEventFlags | flags() const |
| QPointF | lastPos() const |
| QPointF | lastScenePos() const |
| QPoint | lastScreenPos() const |
| Qt::KeyboardModifiers | modifiers() const |
| QPointF | pos() const |
| QPointF | scenePos() const |
| QPoint | screenPos() const |
| Qt::MouseEventSource | source() const |
詳細な説明
QGraphicsView がQMouseEvent を受け取ると、それをQGraphicsSceneMouseEventに変換します。その後、そのイベントはビューに関連付けられたQGraphicsScene に転送されます。イベントがシーンによって処理されない場合、ビューはそのイベントを利用できます(例:DragMode )。
マウスイベントには、イベントのアイテム座標、シーン座標、画面座標(pos()、scenePos()、screenPos()として)に加え、ビューが受信した直前のマウスイベントの座標も含まれています。これらは、lastPos()、lastScreenPos()、lastScenePos()を使用して取得できます。
QGraphicsSceneContextMenuEvent 、QGraphicsSceneHoverEvent 、QGraphicsSceneWheelEvent 、およびQMouseEventも参照してください 。
メンバ関数のドキュメント
[virtual noexcept] QGraphicsSceneMouseEvent::~QGraphicsSceneMouseEvent()
イベントを削除します。
Qt::MouseButton QGraphicsSceneMouseEvent::button() const
イベントを引き起こしたマウスボタン(ある場合)を返します。
buttons() およびmodifiers()も参照してください 。
QPointF QGraphicsSceneMouseEvent::buttonDownPos(Qt::MouseButton button) const
指定されたbutton がクリックされた位置を、アイテム座標系でのマウスカーソルの位置として返します。
関連項目: buttonDownScenePos()、buttonDownScreenPos()、pos()。
QPointF QGraphicsSceneMouseEvent::buttonDownScenePos(Qt::MouseButton button) const
指定されたbutton がクリックされた位置の、シーン座標におけるマウスカーソルの位置を返します。
buttonDownPos()、buttonDownScreenPos()、およびscenePos()も参照してください 。
QPoint QGraphicsSceneMouseEvent::buttonDownScreenPos(Qt::MouseButton button) const
指定されたbutton がクリックされた位置の、画面座標におけるマウスカーソルの位置を返します。
screenPos()、buttonDownPos()、およびbuttonDownScenePos()も参照してください 。
Qt::MouseButtons QGraphicsSceneMouseEvent::buttons() const
イベントが送信された時点で押されていたマウスボタンの組み合わせを返します。
button() およびmodifiers()も参照してください 。
Qt::MouseEventFlags QGraphicsSceneMouseEvent::flags() const
マウスイベントフラグを返します。
マウスイベントフラグは、マウスイベントに関する追加情報を提供します。
Qt::MouseEventFlag およびQMouseEvent::flags()も参照してください 。
QPointF QGraphicsSceneMouseEvent::lastPos() const
アイテム座標系における、最後に記録されたマウスカーソルの位置を返します。
lastScenePos()、lastScreenPos()、およびpos()も参照してください 。
QPointF QGraphicsSceneMouseEvent::lastScenePos() const
シーン座標系における、最後に記録されたマウスカーソルの位置を返します。最後に記録された位置とは、そのイベントを生成したビューが受信した直前のマウスイベントの位置を指します。
lastPos()、lastScreenPos()、およびscenePos()も参照してください 。
QPoint QGraphicsSceneMouseEvent::lastScreenPos() const
最後に記録されたマウスカーソルの位置を画面座標で返します。最後に記録された位置とは、そのイベントを生成したビューが受信した直前のマウスイベントの位置を指します。
lastPos()、lastScenePos()、およびscreenPos()も参照してください 。
Qt::KeyboardModifiers QGraphicsSceneMouseEvent::modifiers() const
イベントが送信された時点で使用されていたキーボード修飾キーを返します。
buttons() およびbutton()も参照してください 。
QPointF QGraphicsSceneMouseEvent::pos() const
マウスカーソルの位置をアイテム座標で返します。
scenePos()、screenPos()、およびlastPos()も参照してください 。
QPointF QGraphicsSceneMouseEvent::scenePos() const
シーン座標におけるマウスカーソルの位置を返します。
pos()、screenPos()、およびlastScenePos()も参照してください 。
QPoint QGraphicsSceneMouseEvent::screenPos() const
マウスカーソルの位置を画面座標で返します。
pos()、scenePos()、およびlastScreenPos()も参照してください 。
Qt::MouseEventSource QGraphicsSceneMouseEvent::source() const
マウスイベントの発生源に関する情報を返します。
マウスイベントの発生源を使用することで、本物のマウスイベントと人工的なマウスイベントを区別することができます。後者は、オペレーティングシステムまたはQt自体によってタッチイベントから合成されたイベントです。
Qt::MouseEventSource およびQMouseEvent::source()も参照してください 。
© 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.