diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-06-21 14:43:39 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-01-02 14:14:38 +0100 |
commit | 05e5306787d3511ce9df2ffc8dbefe529f889eb6 (patch) | |
tree | afcfd86daf93b1d5c3b556552d45eebc53c77ae8 /examples/widgets/widgets/styles/norwegianwoodstyle.h | |
parent | a6f56251ca6090cb0ba4c4989d7ccc638b1dbe2b (diff) |
styles example: Implement standarPalette()
Instead of polishing the (possible) system palette. Makes the checkbox
for "Use style's standard palette" actually work for the custom style,
and is how styles are supposed to provide their own preferred palette.
Change-Id: I3228ef45c023d0d058e48ff0fc14f094367b2008
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'examples/widgets/widgets/styles/norwegianwoodstyle.h')
-rw-r--r-- | examples/widgets/widgets/styles/norwegianwoodstyle.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/widgets/widgets/styles/norwegianwoodstyle.h b/examples/widgets/widgets/styles/norwegianwoodstyle.h index 5a1783eb4d..62ca502d05 100644 --- a/examples/widgets/widgets/styles/norwegianwoodstyle.h +++ b/examples/widgets/widgets/styles/norwegianwoodstyle.h @@ -66,7 +66,8 @@ class NorwegianWoodStyle : public QProxyStyle public: NorwegianWoodStyle(); - void polish(QPalette &palette) override; + QPalette standardPalette() const override; + void polish(QWidget *widget) override; void unpolish(QWidget *widget) override; int pixelMetric(PixelMetric metric, const QStyleOption *option, @@ -82,6 +83,7 @@ private: static void setTexture(QPalette &palette, QPalette::ColorRole role, const QImage &image); static QPainterPath roundRectPath(const QRect &rect); + mutable QPalette m_standardPalette; }; //! [0] |