summaryrefslogtreecommitdiff
path: root/src/controls/Private
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-04-21 23:18:49 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-04-22 06:31:23 +0000
commit3411c3579fb9e767c819c0c8d9f35c52c9964b06 (patch)
treebb59e29289d4f4c88f92ccae9f0e9b63acb26aab /src/controls/Private
parent2ee6ef43d681746d07c1175738184715ce0d84e4 (diff)
downloadqtquickcontrols-3411c3579fb9e767c819c0c8d9f35c52c9964b06.tar.gz
Add support for QT_QUICK_CONTROLS_1_STYLE
Takes priority over QT_QUICK_CONTROLS_STYLE to allow specifying system wide style name preferences separately for Qt Quick Controls 1 and 2. [ChangeLog][Controls] Added support for a QT_QUICK_CONTROLS_1_STYLE environment variable, which takes priority over the existing variable QT_QUICK_CONTROLS_STYLE. This allows specifying system wide style name preferences separately for Qt Quick Controls 1 and 2. Change-Id: I0e40c2790c24b7ef66b1995b8337e573bb2f75a2 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/controls/Private')
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index 32efd332..8861296d 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -70,9 +70,17 @@ static QString defaultStyleName()
return QLatin1String("Base");
}
+static QString styleEnvironmentVariable()
+{
+ QString style = qgetenv("QT_QUICK_CONTROLS_1_STYLE");
+ if (style.isEmpty())
+ style = qgetenv("QT_QUICK_CONTROLS_STYLE");
+ return style;
+}
+
static QString styleImportName()
{
- QString name = qgetenv("QT_QUICK_CONTROLS_STYLE");
+ QString name = styleEnvironmentVariable();
if (name.isEmpty())
name = defaultStyleName();
return QFileInfo(name).fileName();
@@ -174,7 +182,7 @@ static QString relativeStyleImportPath(QQmlEngine *engine, const QString &styleN
static QString styleImportPath(QQmlEngine *engine, const QString &styleName)
{
- QString path = qgetenv("QT_QUICK_CONTROLS_STYLE");
+ QString path = styleEnvironmentVariable();
QFileInfo info(path);
if (fromResource(path)) {
path = info.path();
@@ -209,7 +217,7 @@ QQuickControlSettings1::QQuickControlSettings1(QQmlEngine *engine)
m_name = styleImportName();
// If the style name is a path..
- const QString styleNameFromEnvVar = qgetenv("QT_QUICK_CONTROLS_STYLE");
+ const QString styleNameFromEnvVar = styleEnvironmentVariable();
if (QFile::exists(styleNameFromEnvVar)) {
StyleData styleData;
styleData.m_styleDirPath = styleNameFromEnvVar;