How do I use QStyle::SH_ToolTip_WakeUpDelay to set

2019-08-10 16:02发布

It seems QStyle::SH_ToolTip_WakeUpDelay can be used to set tooltip wake-up time. How do I do it in C++ code?

标签: c++ qt qt5 qstyle
1条回答
Juvenile、少年°
2楼-- · 2019-08-10 16:48

You can use a QProxyStyle to override the default hints provided by whatever style you're using.

Like:

class ProxyStyle : public QProxyStyle
{
    Q_OBJECT
public:
    int styleHint(StyleHint hint, 
                  const QStyleOption *option,
                  const QWidget *widget, 
                  QStyleHintReturn *returnData) const Q_DECL_OVERRIDE
    {
        if (hint == QStyle::SH_ToolTip_WakeUpDelay)
            return 123; // or whatever you want

        return QProxyStyle::styleHint(hint, option, widget, returnData);
    }
};

and then set an instance of this class on your QApplication object.

查看更多
登录 后发表回答