How do I use QStyle::SH_ToolTip_WakeUpDelay to set tooltip wake-up time?

南楼画角 提交于 2019-12-13 18:09:36

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/24719739/how-do-i-use-qstylesh-tooltip-wakeupdelay-to-set-tooltip-wake-up-time

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!