From 3ae271523ff7fb951df16cfccfaf84c0aa298e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 8 Apr 2013 14:12:43 +0200 Subject: Move Fusion styles palette into QtGui So that it can be used as the standard palette for QtGui applications instead of the absolutely useless black palette. Change-Id: Ie001439fcd8840a66275009c9f42cbf8bab4864a Reviewed-by: Shawn Rutledge --- src/gui/kernel/qplatformtheme.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'src/gui/kernel/qplatformtheme.cpp') diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 9f5c789a6e..b8bc72cf73 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -41,6 +41,8 @@ #include "qplatformtheme.h" +#include "qplatformtheme_p.h" + #include #include #include @@ -137,6 +139,33 @@ QT_BEGIN_NAMESPACE \sa themeHint(), QStyle::pixelMetric() */ +QPlatformThemePrivate::QPlatformThemePrivate() + : systemPalette(0) +{ } + +QPlatformThemePrivate::~QPlatformThemePrivate() +{ + delete systemPalette; +} + +Q_GUI_EXPORT QPalette qt_fusionPalette(); + +void QPlatformThemePrivate::initializeSystemPalette() +{ + Q_ASSERT(!systemPalette); + systemPalette = new QPalette(qt_fusionPalette()); +} + +QPlatformTheme::QPlatformTheme() + : d_ptr(new QPlatformThemePrivate) +{ + +} + +QPlatformTheme::QPlatformTheme(QPlatformThemePrivate *priv) + : d_ptr(priv) +{ } + QPlatformTheme::~QPlatformTheme() { @@ -156,7 +185,12 @@ QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType typ const QPalette *QPlatformTheme::palette(Palette type) const { - Q_UNUSED(type) + Q_D(const QPlatformTheme); + if (type == QPlatformTheme::SystemPalette) { + if (!d->systemPalette) + const_cast(this)->d_ptr->initializeSystemPalette(); + return d->systemPalette; + } return 0; } -- cgit v1.2.3