From a90595a10df277b1512382dfb08b762ec417d1cf Mon Sep 17 00:00:00 2001 From: Tomasz Olszak <olszak.tomasz@gmail.com> Date: Wed, 22 May 2013 21:45:23 +0000 Subject: [PATCH] Added handling of QT_QUICK_CONTROLS_STYLE environment variable. Now one can choose which set of styles should be used by the controls. The value should be the name of the QtQuick/Controls/Styles subdir (eg. QT_QUICK_CONTROLS_STYLE=Desktop). NOTE: The environment variable is for internal use and may be removed in the future. Change-Id: I23919270cd1e2406534fafe1134739d145a93538 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> --- src/private/qquickcontrolsettings.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/private/qquickcontrolsettings.cpp b/src/private/qquickcontrolsettings.cpp index 161398322..01456b2a1 100644 --- a/src/private/qquickcontrolsettings.cpp +++ b/src/private/qquickcontrolsettings.cpp @@ -54,14 +54,20 @@ QString QQuickControlSettings::theme() { static QString currentTheme; if (currentTheme.isEmpty()) { - currentTheme = QLatin1String("Styles/Base"); -#ifndef QT_NO_WIDGETS - //Only enable QStyle support when we are using QApplication - if (QCoreApplication::instance()->inherits("QApplication")) { - if (qgetenv("QT_QUICK_CONTROLS_NO_WIDGETS").toInt() < 1) - currentTheme = QLatin1String("Styles/Desktop"); + //Following variable is for internal use only. It is very possible + //that it will disappear in future releases. + currentTheme = qgetenv("QT_QUICK_CONTROLS_STYLE"); + + if (currentTheme.isEmpty()) { + //Only enable QStyle support when we are using QApplication + if (QCoreApplication::instance()->inherits("QApplication")) + currentTheme = QLatin1String("Desktop"); + else + currentTheme = QLatin1String("Base"); } -#endif + + if (!currentTheme.startsWith(QLatin1String("Styles/"))) + currentTheme.prepend(QLatin1String("Styles/")); } return currentTheme; } -- GitLab