本页内容

QGraphicsSceneHoverEvent Class

QGraphicsSceneHoverEvent 类在图形视图框架中提供了悬停事件。更多内容...

头文件: #include <QGraphicsSceneHoverEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
继承自: QGraphicsSceneEvent

公共函数

virtual ~QGraphicsSceneHoverEvent()
QPointF lastPos() const
QPointF lastScenePos() const
QPoint lastScreenPos() const
Qt::KeyboardModifiers modifiers() const
QPointF pos() const
QPointF scenePos() const
QPoint screenPos() const

详细说明

当QGraphicsView 接收到QHoverEvent 事件时,会将其转换为QGraphicsSceneHoverEvent。随后,该事件会被转发给与该视图关联的QGraphicsScene 。

另请参阅 QGraphicsSceneMouseEvent 、QGraphicsSceneContextMenuEvent 、QGraphicsSceneWheelEvent 和QHoverEvent 。

成员函数文档

[virtual noexcept] QGraphicsSceneHoverEvent::~QGraphicsSceneHoverEvent()

销毁该事件。

QPointF QGraphicsSceneHoverEvent::lastPos() const

返回以项目坐标系表示的最后记录的鼠标光标位置。

另请参阅 lastScenePos()、lastScreenPos(),以及pos()。

QPointF QGraphicsSceneHoverEvent::lastScenePos() const

返回视图接收到的上一次鼠标或悬停事件中,最后记录的场景坐标,该事件生成了场景坐标系中的鼠标光标位置。

另请参阅 lastPos()、lastScreenPos() 和scenePos()。

QPoint QGraphicsSceneHoverEvent::lastScreenPos() const

返回最后记录的鼠标光标位置(以屏幕坐标表示)。最后记录的位置是指创建该事件的视图所接收到的上一次鼠标或悬停事件的位置。

另请参阅 lastPos()、lastScenePos() 和screenPos()。

Qt::KeyboardModifiers QGraphicsSceneHoverEvent::modifiers() const

返回触发悬停事件时当前的键盘修饰键。

QPointF QGraphicsSceneHoverEvent::pos() const

返回在触发悬停事件的瞬间,鼠标光标在项目坐标系中的位置。

另请参阅 scenePos() 和screenPos()。

QPointF QGraphicsSceneHoverEvent::scenePos() const

返回发送悬停事件时鼠标光标在场景坐标系中的位置。

另请参阅 pos() 和screenPos()。

QPoint QGraphicsSceneHoverEvent::screenPos() const

返回发送悬停事件时鼠标光标在屏幕坐标系中的位置。

另请参阅 pos() 和scenePos()。

© 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.