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>
This commit is contained in:
parent
d6d119ac6e
commit
c49c96fbb1
@ -1073,7 +1073,10 @@ void QApplication::setStyle(QStyle *style)
|
|||||||
if (QApplicationPrivate::set_pal) {
|
if (QApplicationPrivate::set_pal) {
|
||||||
QApplication::setPalette(*QApplicationPrivate::set_pal);
|
QApplication::setPalette(*QApplicationPrivate::set_pal);
|
||||||
} else if (QApplicationPrivate::sys_pal) {
|
} else if (QApplicationPrivate::sys_pal) {
|
||||||
|
clearSystemPalette();
|
||||||
|
initSystemPalette();
|
||||||
QApplicationPrivate::initializeWidgetPaletteHash();
|
QApplicationPrivate::initializeWidgetPaletteHash();
|
||||||
|
QApplicationPrivate::initializeWidgetFontHash();
|
||||||
QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, /*className=*/0, /*clearWidgetPaletteHash=*/false);
|
QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, /*className=*/0, /*clearWidgetPaletteHash=*/false);
|
||||||
} else if (!QApplicationPrivate::sys_pal) {
|
} else if (!QApplicationPrivate::sys_pal) {
|
||||||
// Initialize the sys_pal if it hasn't happened yet...
|
// Initialize the sys_pal if it hasn't happened yet...
|
||||||
|
@ -275,6 +275,8 @@ void QApplicationPrivate::initializeWidgetPaletteHash()
|
|||||||
QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();
|
QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();
|
||||||
if (!platformTheme)
|
if (!platformTheme)
|
||||||
return;
|
return;
|
||||||
|
qt_app_palettes_hash()->clear();
|
||||||
|
|
||||||
setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton");
|
setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton");
|
||||||
setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton");
|
setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton");
|
||||||
setPossiblePalette(platformTheme->palette(QPlatformTheme::CheckBoxPalette), "QCheckBox");
|
setPossiblePalette(platformTheme->palette(QPlatformTheme::CheckBoxPalette), "QCheckBox");
|
||||||
@ -298,6 +300,8 @@ void QApplicationPrivate::initializeWidgetFontHash()
|
|||||||
if (!theme)
|
if (!theme)
|
||||||
return;
|
return;
|
||||||
FontHash *fontHash = qt_app_fonts_hash();
|
FontHash *fontHash = qt_app_fonts_hash();
|
||||||
|
fontHash->clear();
|
||||||
|
|
||||||
if (const QFont *font = theme->font(QPlatformTheme::MenuFont))
|
if (const QFont *font = theme->font(QPlatformTheme::MenuFont))
|
||||||
fontHash->insert(QByteArrayLiteral("QMenu"), *font);
|
fontHash->insert(QByteArrayLiteral("QMenu"), *font);
|
||||||
if (const QFont *font = theme->font(QPlatformTheme::MenuBarFont))
|
if (const QFont *font = theme->font(QPlatformTheme::MenuBarFont))
|
||||||
|
Loading…
Reference in New Issue
Block a user