QGraphicsSceneMouseEvent 类

QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework. 更多...

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

公共函数

~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

额外继承成员

详细描述

QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.

QGraphicsView 接收 QMouseEvent , it translates it to a QGraphicsSceneMouseEvent . The event is then forwarded to the 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 ().