QGraphicsSceneHelpEvent Class
QGraphicsSceneHelpEvent 类在请求显示工具提示时会触发事件。更多内容...
| 头文件: | #include <QGraphicsSceneHelpEvent> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 继承自: | QGraphicsSceneEvent |
公共函数
| virtual | ~QGraphicsSceneHelpEvent() |
| QPointF | scenePos() const |
| QPoint | screenPos() const |
详细描述
当QGraphicsView 接收到类型为QEvent::ToolTip 的QEvent 时,它会创建一个QGraphicsSceneHelpEvent,并将该事件转发给场景。您可以通过setToolTip()为QGraphicsItem 设置工具提示;默认情况下,QGraphicsScene 会显示鼠标位置下方z值最高(即最顶层)的QGraphicsItem 的工具提示。
QGraphicsView 当调用"What's This" 和status tip 请求帮助时,不会转发事件。如果需要此功能,可以重写QGraphicsView::viewportEvent() 方法,并将QStatusTipEvent 事件以及类型为QEvent::WhatsThis 的QEvents 转发至场景。
另请参阅 QEvent 。
© 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.