summaryrefslogtreecommitdiff
path: root/src/controls/Private/qquickcontrolsettings.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@theqtcompany.com>2016-03-01 12:53:29 +0100
committerAndy Shaw <andy.shaw@theqtcompany.com>2016-03-15 13:58:59 +0000
commitb4c13916ec0fd7796acdf0ec5a1db0134479b3f2 (patch)
treee2c5beb07d1da652af48e045c6899739bedef3d2 /src/controls/Private/qquickcontrolsettings.cpp
parenta275fb3d29d5560af22ef5c4a721ce9bf2a2ccc1 (diff)
downloadqtquickcontrols-b4c13916ec0fd7796acdf0ec5a1db0134479b3f2.tar.gz
Enable using the module in a statically built application
Task-number: QTBUG-35754 Task-number: QTBUG-45868 Change-Id: I9bb332bc85713a17f02f3e7e768592e3234edfe3 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls/Private/qquickcontrolsettings.cpp')
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index 6ced68ff..39758e4e 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -149,6 +149,7 @@ QQmlComponent *QQuickControlSettings::styleComponent(const QUrl &styleDirUrl, co
static QString relativeStyleImportPath(QQmlEngine *engine, const QString &styleName)
{
QString path;
+#ifndef QT_STATIC
bool found = false;
const auto importPathList = engine->importPathList();
for (const QString &import : importPathList) {
@@ -163,6 +164,9 @@ static QString relativeStyleImportPath(QQmlEngine *engine, const QString &styleN
}
if (!found)
path = ":/QtQuick/Controls/Styles";
+#else
+ path = ":/qt-project.org/imports/QtQuick/Controls/Styles";
+#endif
return path;
}
@@ -175,7 +179,11 @@ static QString styleImportPath(QQmlEngine *engine, const QString &styleName)
} else if (info.isRelative()) {
path = relativeStyleImportPath(engine, styleName);
} else {
+#ifndef QT_STATIC
path = info.absolutePath();
+#else
+ path = "qrc:/qt-project.org/imports/QtQuick/Controls/Styles";
+#endif
}
return path;
}
@@ -185,7 +193,11 @@ QQuickControlSettings::QQuickControlSettings(QQmlEngine *engine)
// First, register all style paths in the default style location.
QDir dir;
const QString defaultStyle = defaultStyleName();
+#ifndef QT_STATIC
dir.setPath(relativeStyleImportPath(engine, defaultStyle));
+#else
+ dir.setPath(":/qt-project.org/imports/QtQuick/Controls/Styles");
+#endif
dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
const auto list = dir.entryList();
for (const QString &styleDirectory : list) {
@@ -265,6 +277,7 @@ void QQuickControlSettings::findStyle(QQmlEngine *engine, const QString &styleNa
StyleData styleData;
+#ifndef QT_STATIC
const auto list = dir.entryList();
for (const QString &fileName : list) {
// This assumes that there is only one library in the style directory,
@@ -276,6 +289,7 @@ void QQuickControlSettings::findStyle(QQmlEngine *engine, const QString &styleNa
break;
}
}
+#endif
// If there's no plugin for the style, then the style's files are
// contained in this directory (which contains a qmldir file instead).