diff options
author | Jørgen Lind <jorgen.lind@digia.com> | 2013-04-08 14:12:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-17 07:43:11 +0200 |
commit | 3ae271523ff7fb951df16cfccfaf84c0aa298e16 (patch) | |
tree | 446402cb007ac348c67ea35b44baedb4f8c3681e /src/gui/kernel/qplatformtheme.cpp | |
parent | d42e54c8626ee0d42d4df40e8f2a83df0698190a (diff) |
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 <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui/kernel/qplatformtheme.cpp')
-rw-r--r-- | src/gui/kernel/qplatformtheme.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
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 <QtCore/QVariant> #include <QtCore/QStringList> #include <QtCore/qfileinfo.h> @@ -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<QPlatformTheme *>(this)->d_ptr->initializeSystemPalette(); + return d->systemPalette; + } return 0; } |