我有一个QGraphicsScene
,我在QGraphicsProxyWidgets
内添加了QPushButtons
。有没有办法显示这些按钮的工具提示?当我将鼠标悬停在按钮上时,setToolTip
会起作用,但什么也不会出现。我需要在QGraphicsScene/View
上指定一些标志吗?在
按钮创建代码的简化版本:
class Button(QPushButton):
def __init__(self, scene):
super(Button, self).__init__()
self.proxy = QGraphicsProxyWidget()
self.proxy.setWidget(self)
scene.addItem(self.proxy)
self.setToolTip("tooltip")
提前谢谢!在
必须将工具提示设置为
QGraphicsProxyWidget
。在示例:
不幸的是,在代理上设置工具提示也不起作用,但是一位同事在我的代码中进一步研究,发现了为什么proxy和button的工具提示都不起作用:我在
QGraphicsView mouseMoveEvent
上设置了一个覆盖,这可能会破坏悬停事件。正在添加。。。在…在
mouseMoveEvent
重写的末尾解决了这个问题。很抱歉弄错了,谢谢你的帮助!在相关问题 更多 >
编程相关推荐