From 74acbcc9f31aa2c64d076e1157979537d90d3f6d Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 28 Aug 2020 16:55:25 +0200 Subject: Fix fallback styles overwriting themes In Qt 5, QtQuickControls2Plugin::registerTypes() was responsible for calling initializeTheme() on each style plugin. Now that we delegate more work to the QML engine, each style plugin calls initializeTheme() via registerTypes(). To avoid fallback styles overwriting font and palette data set by the current style, we need to check if the theme has been intialized before calling initializeTheme(). To do this, we add a static "themeInitialized" bool that QQuickStylePlugin sets to true after calling intializeTheme() for the first time. It checks this value and avoids calling intializeTheme() if it's true. We also need to make QQuickStylePlugin ensure that the theme it's initializing belongs to the current style. Fixes: QTBUG-86303 Change-Id: Ie65e646677c78622829f4949c41cb79204cf5786 Reviewed-by: Richard Moe Gustavsen --- tests/auto/styleimports/styleimports.pro | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/auto/styleimports/styleimports.pro') diff --git a/tests/auto/styleimports/styleimports.pro b/tests/auto/styleimports/styleimports.pro index 774d93e9..398ce7c2 100644 --- a/tests/auto/styleimports/styleimports.pro +++ b/tests/auto/styleimports/styleimports.pro @@ -4,14 +4,15 @@ SOURCES += tst_styleimports.cpp macos:CONFIG -= app_bundle -QT += core-private gui-private qml-private quick-private quickcontrols2-private testlib +QT += core-private gui-private qml-private quick-private quickcontrols2-private quickcontrols2impl-private testlib include (../shared/util.pri) resourcestyle.prefix = / +resourcestyle.base = resources resourcestyle.files += \ - $$PWD/ResourceStyle/Button.qml \ - $$PWD/ResourceStyle/qmldir + $$PWD/resources/ResourceStyle/Button.qml \ + $$PWD/resources/ResourceStyle/qmldir RESOURCES += resourcestyle TESTDATA = data/* -- cgit v1.2.3