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
()
销毁事件。
Returns the mouse button (if any) that caused the event.
另请参阅 buttons () 和 modifiers ().
Returns the mouse cursor position in item coordinates where the specified button was clicked.
另请参阅 buttonDownScenePos (), buttonDownScreenPos (),和 pos ().
Returns the mouse cursor position in scene coordinates where the specified button was clicked.
另请参阅 buttonDownPos (), buttonDownScreenPos (),和 scenePos ().
Returns the mouse cursor position in screen coordinates where the specified button was clicked.
另请参阅 screenPos (), buttonDownPos (),和 buttonDownScenePos ().
Returns the combination of mouse buttons that were pressed at the time the event was sent.
另请参阅 button () 和 modifiers ().
返回鼠标事件标志。
鼠标事件标志提供有关鼠标事件的额外信息。
另请参阅 Qt::MouseEventFlag and QMouseEvent::flags ().
Returns the last recorded mouse cursor position in item coordinates.
另请参阅 lastScenePos (), lastScreenPos (),和 pos ().
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 ().
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 ().
返回发送事件时在使用中的键盘修饰符。
返回在项坐标中的鼠标光标位置。
另请参阅 scenePos (), screenPos (),和 lastPos ().
返回在场景坐标中的鼠标光标位置。
另请参阅 pos (), screenPos (),和 lastScenePos ().
返回在屏幕坐标中的鼠标光标位置。
另请参阅 pos (), scenePos (),和 lastScreenPos ().
返回鼠标事件来源的有关信息。
鼠标事件来源可以用于区分真正和和人造的鼠标事件。后者是由操作系统或 Qt 自身从触摸事件合成的事件。
另请参阅 Qt::MouseEventSource and QMouseEvent::source ().