QGraphicsSceneMouseEvent 類

QGraphicsSceneMouseEvent 類提供在圖形視圖框架中的鼠標事件。 更多...

頭: #include <QGraphicsSceneMouseEvent>
qmake: QT += widgets
Since: Qt 4.2
繼承: QGraphicsSceneEvent

該類在 Qt 4.2 引入。

公共函數

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 .

成員函數文檔編製

[虛擬] QGraphicsSceneMouseEvent:: ~QGraphicsSceneMouseEvent ()

銷毀事件。

Qt::MouseButton QGraphicsSceneMouseEvent:: button () const

Returns the mouse button (if any) that caused the event.

另請參閱 buttons () 和 modifiers ().

QPointF QGraphicsSceneMouseEvent:: buttonDownPos ( Qt::MouseButton button ) const

Returns the mouse cursor position in item coordinates where the specified button was clicked.

另請參閱 buttonDownScenePos (), buttonDownScreenPos (),和 pos ().

QPointF QGraphicsSceneMouseEvent:: buttonDownScenePos ( Qt::MouseButton button ) const

Returns the mouse cursor position in scene coordinates where the specified button was clicked.

另請參閱 buttonDownPos (), buttonDownScreenPos (),和 scenePos ().

QPoint QGraphicsSceneMouseEvent:: buttonDownScreenPos ( Qt::MouseButton button ) const

Returns the mouse cursor position in screen coordinates where the specified button was clicked.

另請參閱 screenPos (), buttonDownPos (),和 buttonDownScenePos ().

Qt::MouseButtons QGraphicsSceneMouseEvent:: buttons () const

Returns the combination of mouse buttons that were pressed at the time the event was sent.

另請參閱 button () 和 modifiers ().

Qt::MouseEventFlags QGraphicsSceneMouseEvent:: flags () const

返迴鼠標事件標誌。

鼠標事件標誌提供有關鼠標事件的額外信息。

該函數在 Qt 5.4 引入。

另請參閱 Qt::MouseEventFlag and QMouseEvent::flags ().

QPointF QGraphicsSceneMouseEvent:: lastPos () const

Returns the last recorded mouse cursor position in item coordinates.

另請參閱 lastScenePos (), lastScreenPos (),和 pos ().

QPointF QGraphicsSceneMouseEvent:: lastScenePos () const

Returns the last recorded mouse cursor position in scene coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.

另請參閱 lastPos (), lastScreenPos (),和 scenePos ().

QPoint QGraphicsSceneMouseEvent:: lastScreenPos () const

Returns the last recorded mouse cursor position in screen coordinates. The last recorded position is the position of the previous mouse event received by the view that created the event.

另請參閱 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 5.4 引入。

另請參閱 Qt::MouseEventSource and QMouseEvent::source ().