aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyle.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-12-01 13:59:53 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-12-01 13:59:53 +0100
commit4ba00f0054ffd183377fd420b35ef7a388c0bcfe (patch)
treedde076314b40ce0dd540e5363ff6d9fca98016f4 /src/quickcontrols2/qquickstyle.cpp
parent948932c9c6ae535647e69962aad2add516802b9c (diff)
parentd8c5dea96fb8861089e2166ae574a85d2b69c09e (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: src/imports/controls/SpinBox.qml src/imports/controls/material/SpinBox.qml src/imports/controls/universal/SpinBox.qml tests/auto/controls/data/tst_swipedelegate.qml Change-Id: Ie1d1f487890f0a9f80a00df5e813e1d2e8303fe5
Diffstat (limited to 'src/quickcontrols2/qquickstyle.cpp')
-rw-r--r--src/quickcontrols2/qquickstyle.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index aa168301..cf4979c1 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -183,6 +183,15 @@ struct QQuickStyleSpec
setFallbackStyle(settings->value(QStringLiteral("FallbackStyle")).toString(), ":/qtquickcontrols2.conf");
}
}
+
+ // resolve a path relative to the config
+ QString configPath = QFileInfo(resolveConfigFilePath()).path();
+ QString stylePath = findStyle(configPath, style);
+ if (!stylePath.isEmpty()) {
+ style = stylePath;
+ resolved = true;
+ }
+
custom = style.contains(QLatin1Char('/'));
if (baseUrl.isValid()) {
@@ -220,11 +229,26 @@ struct QQuickStyleSpec
fallbackMethod.clear();
}
+ QString resolveConfigFilePath()
+ {
+ if (configFilePath.isEmpty()) {
+ configFilePath = QFile::decodeName(qgetenv("QT_QUICK_CONTROLS_CONF"));
+ if (!QFile::exists(configFilePath)) {
+ if (!configFilePath.isEmpty())
+ qWarning("QT_QUICK_CONTROLS_CONF=%s: No such file", qPrintable(configFilePath));
+
+ configFilePath = QStringLiteral(":/qtquickcontrols2.conf");
+ }
+ }
+ return configFilePath;
+ }
+
bool custom;
bool resolved;
QString style;
QString fallbackStyle;
QByteArray fallbackMethod;
+ QString configFilePath;
};
Q_GLOBAL_STATIC(QQuickStyleSpec, styleSpec)
@@ -282,6 +306,11 @@ void QQuickStylePrivate::reset()
styleSpec()->reset();
}
+QString QQuickStylePrivate::configFilePath()
+{
+ return styleSpec()->resolveConfigFilePath();
+}
+
/*!
Returns the name of the application style.