From 32f05c5f5f5a580af0e0fe0964d71cf498ce391b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 25 Jan 2019 14:04:28 +0100 Subject: Fix font and palette settings in .conf files not being respected In 5.11, the font palette read from the qtquickcontrols2.conf file was respected. After some large architectural changes (around the time of 94780538) required to fix a crash, 5.12 stopped respecting these settings. This patch fixes the issue by setting the default font as the System scope font, because that's what QQuickControlPrivate::parentFont() uses as its fallback if no parent item has a font explicitly set. QQuickControlPrivate::parentFont() is used as the starting point for font inheritance/resolution for each control. The same fix is used for palettes. Change-Id: I706a9f109c9959b8ea6b91f842146dbfc876cb2b Fixes: QTBUG-72023 Reviewed-by: Nils Jeisecke Reviewed-by: Frederik Gladhorn --- src/imports/controls/qtquickcontrols2plugin.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/imports/controls/qtquickcontrols2plugin.cpp') diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index a03cbd06..5e9f253d 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -302,7 +302,15 @@ QQuickTheme *QtQuickControls2Plugin::createTheme(const QString &name) QSharedPointer settings = QQuickStylePrivate::settings(name); if (settings) { p->defaultFont.reset(QQuickStylePrivate::readFont(settings)); + // Set the default font as the System scope, because that's what + // QQuickControlPrivate::parentFont() uses as its fallback if no + // parent item has a font explicitly set. QQuickControlPrivate::parentFont() + // is used as the starting point for font inheritance/resolution. + // The same goes for palettes below. + theme->setFont(QQuickTheme::System, *p->defaultFont); + p->defaultPalette.reset(QQuickStylePrivate::readPalette(settings)); + theme->setPalette(QQuickTheme::System, *p->defaultPalette); } #endif QQuickThemePrivate::instance.reset(theme); -- cgit v1.2.3