Is it possible to change the time delay between the mouse being still in a window, and the tooltip's show event?
Is there a Qt wrapper for something like TTM_SETDELAYTIME
? According to the Windows documentation, the default value depends on the double-click interval.
You'll have to set a custom QProxyStyle
that overrides styleHint()
and returns your preferred value for QStyle::SH_ToolTip_WakeUpDelay
. Sample code below.
class CustomStyle : public QProxyStyle
{
Q_OBJECT
\\...
public:
int styleHint(StyleHint hint, const QStyleOption *option = nullptr,
const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override
{
if (hint == SH_ToolTip_WakeUpDelay)
return someCustomValue;
else
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
}
Apparently that's not possible with the built-in Qt Tooltips. In 4.8 qapplication.cpp
they use magic numbers:
d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive()?20:700, this);
So the default behavior is to show a tooltip after 700 ms, and start a 2000 ms fall-asleep timer. If we hover over another window(widget) with the fall-asleep timer still active, the delay will be reduced to 20 ms, probably under the assumption that the first tooltip was not the one the user wanted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With