PySide6.QtWidgets.QGraphicsSceneHelpEvent

class QGraphicsSceneHelpEvent

QGraphicsSceneHelpEvent 类在请求工具提示时提供事件。更多

PySide6.QtWidgets.QGraphicsSceneHelpEvent 的继承图

概要

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

QGraphicsView接收到类型为QEvent::ToolTip的QEvent时,它会创建一个QGraphicsSceneHelpEvent,并将其转发到场景中。你可以使用setToolTip()QGraphicsItem上设置工具提示;默认情况下,QGraphicsScene会显示鼠标位置下具有最高z值(即最顶部的项目)的QGraphicsItem的工具提示。

QGraphicsView 在请求 "What's This" 和状态提示帮助时不会转发事件。如果你需要这个功能,你可以重新实现 viewportEvent() 并将 QStatusTipEvent 事件和类型为 QEvent::WhatsThis 的 QEvent 转发到场景。

另请参阅

QEvent

__init__([type=QEvent.Type.None])
Parameters:

类型Type

scenePos()
Return type:

QPointF

返回帮助事件发送时鼠标光标在场景坐标中的位置。

另请参阅

screenPos()

screenPos()
Return type:

QPoint

返回在发送帮助事件时鼠标光标在屏幕坐标中的位置。

另请参阅

scenePos()

setScenePos(pos)
Parameters:

posQPointF

setScreenPos(pos)
Parameters:

posQPoint