diff options
| author | Tomasz Olszak <olszak.tomasz@gmail.com> | 2013-05-22 21:45:23 +0000 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-23 20:52:17 +0200 |
| commit | a90595a10df277b1512382dfb08b762ec417d1cf (patch) | |
| tree | 31b570f4d474b4411b882c677a8ae66db979f5e6 /src/private/qquickcontrolsettings.cpp | |
| parent | 91ccf2b4f5073e369353bb3dda3c5a4fd72b5adb (diff) | |
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>
Diffstat (limited to 'src/private/qquickcontrolsettings.cpp')
| -rw-r--r-- | src/private/qquickcontrolsettings.cpp | 20 |
1 files 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; } |
