From 05e5306787d3511ce9df2ffc8dbefe529f889eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 21 Jun 2019 14:43:39 +0200 Subject: 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 --- examples/widgets/widgets/styles/norwegianwoodstyle.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/widgets/widgets/styles/norwegianwoodstyle.h') 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] -- cgit v1.2.3