diff options
-rw-r--r-- | src/gui/kernel/qpalette.cpp | 1 | ||||
-rw-r--r-- | src/platformsupport/themes/genericunix/qgenericunixthemes.cpp | 32 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 13 |
3 files changed, 24 insertions, 22 deletions
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 9a2eb12e3f..ab62ec0992 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -524,6 +524,7 @@ QPalette::QPalette() } else { init(); qt_palette_from_color(*this, Qt::black); + resolve_mask = 0; } } diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index 597dbde74f..5c57b0c12f 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -136,21 +136,19 @@ static inline bool kdeColor(QPalette *pal, QPalette::ColorRole role, return true; } -// Reads the KDE system palette -static inline bool readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal) +static inline void readKdeSystemPalette(const QSettings &kdeSettings, QPalette *pal) { - // Setup KDE palette - return kdeColor(pal, QPalette::Button, kdeSettings, QStringLiteral("Colors:Button/BackgroundNormal")) - || kdeColor(pal, QPalette::Window, kdeSettings, QStringLiteral("Colors:Window/BackgroundNormal")) - || kdeColor(pal, QPalette::Text, kdeSettings, QStringLiteral("Colors:View/ForegroundNormal")) - || kdeColor(pal, QPalette::WindowText, kdeSettings, QStringLiteral("Colors:Window/ForegroundNormal")) - || kdeColor(pal, QPalette::Base, kdeSettings, QStringLiteral("Colors:View/BackgroundNormal")) - || kdeColor(pal, QPalette::Highlight, kdeSettings, QStringLiteral("Colors:Selection/BackgroundNormal")) - || kdeColor(pal, QPalette::HighlightedText, kdeSettings, QStringLiteral("Colors:Selection/ForegroundNormal")) - || kdeColor(pal, QPalette::AlternateBase, kdeSettings, QStringLiteral("Colors:View/BackgroundAlternate")) - || kdeColor(pal, QPalette::ButtonText, kdeSettings, QStringLiteral("Colors:Button/ForegroundNormal")) - || kdeColor(pal, QPalette::Link, kdeSettings, QStringLiteral("Colors:View/ForegroundLink")) - || kdeColor(pal, QPalette::LinkVisited, kdeSettings, QStringLiteral("Colors:View/ForegroundVisited")); + kdeColor(pal, QPalette::Button, kdeSettings, QStringLiteral("Colors:Button/BackgroundNormal")); + kdeColor(pal, QPalette::Window, kdeSettings, QStringLiteral("Colors:Window/BackgroundNormal")); + kdeColor(pal, QPalette::Text, kdeSettings, QStringLiteral("Colors:View/ForegroundNormal")); + kdeColor(pal, QPalette::WindowText, kdeSettings, QStringLiteral("Colors:Window/ForegroundNormal")); + kdeColor(pal, QPalette::Base, kdeSettings, QStringLiteral("Colors:View/BackgroundNormal")); + kdeColor(pal, QPalette::Highlight, kdeSettings, QStringLiteral("Colors:Selection/BackgroundNormal")); + kdeColor(pal, QPalette::HighlightedText, kdeSettings, QStringLiteral("Colors:Selection/ForegroundNormal")); + kdeColor(pal, QPalette::AlternateBase, kdeSettings, QStringLiteral("Colors:View/BackgroundAlternate")); + kdeColor(pal, QPalette::ButtonText, kdeSettings, QStringLiteral("Colors:Button/ForegroundNormal")); + kdeColor(pal, QPalette::Link, kdeSettings, QStringLiteral("Colors:View/ForegroundLink")); + kdeColor(pal, QPalette::LinkVisited, kdeSettings, QStringLiteral("Colors:View/ForegroundVisited")); } /*! @@ -215,9 +213,9 @@ void QKdeTheme::refresh() const QSettings kdeSettings(settingsFile, QSettings::IniFormat); - QPalette systemPalette; - if (readKdeSystemPalette(kdeSettings, &systemPalette)) - m_resources.palettes[SystemPalette] = new QPalette(systemPalette); + QPalette systemPalette = QPalette(); + readKdeSystemPalette(kdeSettings, &systemPalette); + m_resources.palettes[SystemPalette] = new QPalette(systemPalette); //## TODO tooltip color const QVariant styleValue = kdeSettings.value(QStringLiteral("widgetStyle")); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 348eb2f343..7441d55865 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -130,14 +130,17 @@ QApplicationPrivate *QApplicationPrivate::self = 0; static void initSystemPalette() { - if (!QApplicationPrivate::sys_pal) + if (!QApplicationPrivate::sys_pal) { + QPalette defaultPlatte; + if (QApplicationPrivate::app_style) + defaultPlatte = QApplicationPrivate::app_style->standardPalette(); if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) { - QApplicationPrivate::setSystemPalette(*themePalette); + QApplicationPrivate::setSystemPalette(themePalette->resolve(defaultPlatte)); QApplicationPrivate::initializeWidgetPaletteHash(); + } else { + QApplicationPrivate::setSystemPalette(defaultPlatte); } - - if (!QApplicationPrivate::sys_pal && QApplicationPrivate::app_style) - QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette()); + } } static void clearSystemPalette() |