从小部件取消设置QStyle

时间:2017-01-08 21:26:46

标签: c++ qt5

如何从窗口小部件中取消设置QStyle并恢复是QStyle为默认值?

class MyStyle : public QProxyStyle
{
public:
    using QProxyStyle::QProxyStyle;
    int styleHint(QStyle::StyleHint hint, const QStyleOption* option = 0,
                  const QWidget* widget = 0, QStyleHintReturn* returnData = 0) const
    {
        if (hint == SH_Slider_AbsoluteSetButtons)
            return (Qt::LeftButton | Qt::MidButton | Qt::RightButton);
        return QProxyStyle::styleHint(hint, option, widget, returnData);
    }

};

myWidget->setStyle(new MyStyle(myWidget->style()));

0 个答案:

没有答案