aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyleplugin.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-09-30 14:22:42 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-10-07 13:31:20 +0200
commit81e8cd67198768a08f5c65ec026e1553f78e1375 (patch)
treedccf23caaf08f06e3436e43993be8fa74093a1d0 /src/quickcontrols2/qquickstyleplugin.cpp
parent8b534487044dfb3b464431ecb91ef4e0864af4ed (diff)
Make tests explicitly use Basic where necessary
The previous commit changes the how the default style is set, and since the tests all assumed that Basic was the default, we now need to ensure it is explicitly set. If we want to, we can revert this patch (or file-by-file) later and ensure that these tests work with all styles. For now, just keep things working as they used to. Tests that use QTEST_QUICKCONTROLS_MAIN are not changed, as they already run with all built-in styles. Tests that don't use types that will cause issues, like tst_qquickcolor, do not need to be changed. tst_snippets can be run manually to produce screenshots, so we specify its style in a qtquickcontrols2.conf file to allow it to be overridden by e.g. application arguments (QQuickStyle::setStyle() takes precedence over all other approaches of setting a style). Change-Id: Ifae7e959f89a41a757c170272038fad139bba04f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/quickcontrols2/qquickstyleplugin.cpp')
-rw-r--r--src/quickcontrols2/qquickstyleplugin.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp
index 730a8423..27299b21 100644
--- a/src/quickcontrols2/qquickstyleplugin.cpp
+++ b/src/quickcontrols2/qquickstyleplugin.cpp
@@ -63,7 +63,9 @@ void QQuickStylePlugin::registerTypes(const char *uri)
qCDebug(lcStylePlugin).nospace() << "registerTypes called with uri " << uri << "; plugin name is " << name();
const QTypeRevision latestControlsRevision = QQmlMetaType::latestModuleVersion(QLatin1String("QtQuick.Controls"));
- QString styleName = QQuickStyle::name();
+ // Use the private function because we don't want to cause resolve() to be called,
+ // as the logic that assigns a default style if one wasn't set would interfere with compile-time style selection.
+ QString styleName = QQuickStylePrivate::style();
if (!latestControlsRevision.isValid() && styleName.isEmpty()) {
// The user hasn't imported QtQuick.Controls, nor set a style via the runtime methods.
qCDebug(lcStylePlugin).nospace() << uri << " imported before QtQuick.Controls; using compile-time style selection";