diff options
author | BogDan Vatra <bogdan@kde.org> | 2013-09-01 12:03:57 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-10 11:52:40 +0200 |
commit | c49c96fbb13912a749942f8f90a6d91656a11852 (patch) | |
tree | 749a823f14d36b95281a095cebdc098963a622de /src/widgets/kernel | |
parent | d6d119ac6e606a30993bfea1ac3309f74d15bedc (diff) |
Reinitialize system palette when setting a new style.
Task-number: QTBUG-29565
Change-Id: I5ac95d52c453aec9e2160a135dc1afdd9583eed3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_qpa.cpp | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index af3d134a5a..a8d13c64ee 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1073,7 +1073,10 @@ void QApplication::setStyle(QStyle *style) if (QApplicationPrivate::set_pal) { QApplication::setPalette(*QApplicationPrivate::set_pal); } else if (QApplicationPrivate::sys_pal) { + clearSystemPalette(); + initSystemPalette(); QApplicationPrivate::initializeWidgetPaletteHash(); + QApplicationPrivate::initializeWidgetFontHash(); QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, /*className=*/0, /*clearWidgetPaletteHash=*/false); } else if (!QApplicationPrivate::sys_pal) { // Initialize the sys_pal if it hasn't happened yet... diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp index b947f1b497..1f8e950d00 100644 --- a/src/widgets/kernel/qapplication_qpa.cpp +++ b/src/widgets/kernel/qapplication_qpa.cpp @@ -275,6 +275,8 @@ void QApplicationPrivate::initializeWidgetPaletteHash() QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme(); if (!platformTheme) return; + qt_app_palettes_hash()->clear(); + setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton"); setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton"); setPossiblePalette(platformTheme->palette(QPlatformTheme::CheckBoxPalette), "QCheckBox"); @@ -298,6 +300,8 @@ void QApplicationPrivate::initializeWidgetFontHash() if (!theme) return; FontHash *fontHash = qt_app_fonts_hash(); + fontHash->clear(); + if (const QFont *font = theme->font(QPlatformTheme::MenuFont)) fontHash->insert(QByteArrayLiteral("QMenu"), *font); if (const QFont *font = theme->font(QPlatformTheme::MenuBarFont)) |