I've read that I can use QStyle.SH_ToolTip_WakeUpDelay
to create a delay before the tool tip is shown, but I didn't figured out how exactly. I already read this question: How do I use QStyle::SH_ToolTip_WakeUpDelay to set tooltip wake-up time?
I'm not familiar with C++, but I tried to recreate it. I just made a class and overwrited the method styleHint
, but it doesn't work.
My code:
class ProxyStyle(QProxyStyle):
def __init__(self):
super().__init__()
def styleHint(self, hint: QStyle.StyleHint, option: Optional['QStyleOption'] = ..., widget: Optional[QWidget] = ..., returnData: Optional['QStyleHintReturn'] = ...) -> int:
if hint == QStyle.SH_ToolTip_WakeUpDelay:
return 1000 # I just assumed it's in milliseconds, so I did 1000 to have a delay of 1s.
return QProxyStyle.styleHint(hint, option, widget, returnData)
As the guy answered in the above mentioned question, I added an instance of the class to my application. I don't know exactly if I understood it correctly, but I just did that:
proxyStyle = QProxyStyle()
app = QApplication([proxyStyle])
app.exec()
Edit
I did it like that now, but it also doesn't work (I expect a 1s delay):
proxyStyle = QProxyStyle()
app = QApplication([])
app.setStyle(proxyStyle)