aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyle.cpp
diff options
context:
space:
mode:
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 d7143be7..3ad7c074 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()) {
@@ -221,11 +230,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)
@@ -262,6 +286,11 @@ void QQuickStylePrivate::reset()
styleSpec()->reset();
}
+QString QQuickStylePrivate::configFilePath()
+{
+ return styleSpec()->resolveConfigFilePath();
+}
+
/*!
Returns the name of the application style.