diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-08-28 16:55:25 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-09-24 13:48:39 +0200 |
commit | 74acbcc9f31aa2c64d076e1157979537d90d3f6d (patch) | |
tree | c896835ef345e8663aee2b6bf4b13e5779a6fd58 /tests/auto/styleimports/styleimports.pro | |
parent | 6059a7765b123a6f3fb221db9674a995bae1881c (diff) |
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 <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/styleimports/styleimports.pro')
-rw-r--r-- | tests/auto/styleimports/styleimports.pro | 7 |
1 files changed, 4 insertions, 3 deletions
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/* |