summaryrefslogtreecommitdiff
path: root/src/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp14
-rw-r--r--src/controls/Styles/Android/plugin.cpp8
-rw-r--r--src/controls/Styles/styles.pri2
-rw-r--r--src/controls/controls.pro57
-rw-r--r--src/controls/plugin.cpp19
-rw-r--r--src/controls/plugin.h1
6 files changed, 73 insertions, 28 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).
diff --git a/src/controls/Styles/Android/plugin.cpp b/src/controls/Styles/Android/plugin.cpp
index 3c6f37e8..0454c40d 100644
--- a/src/controls/Styles/Android/plugin.cpp
+++ b/src/controls/Styles/Android/plugin.cpp
@@ -44,6 +44,13 @@
#include "qquickandroidstyle_p.h"
#include "qquickandroid9patch_p.h"
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Controls_Styles_Android);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class QtQuickControlsAndroidStylePlugin: public QQmlExtensionPlugin
@@ -52,6 +59,7 @@ class QtQuickControlsAndroidStylePlugin: public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtQuickControlsAndroidStylePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
void registerTypes(const char *uri);
};
diff --git a/src/controls/Styles/styles.pri b/src/controls/Styles/styles.pri
index 74dbd67b..365dd61a 100644
--- a/src/controls/Styles/styles.pri
+++ b/src/controls/Styles/styles.pri
@@ -110,4 +110,4 @@ STYLES_QML_FILES += \
STYLES_QML_FILES += $$PWD/qmldir
-!qtquickcompiler: QML_FILES += $$STYLES_QML_FILES
+!qtquickcompiler|static: QML_FILES += $$STYLES_QML_FILES
diff --git a/src/controls/controls.pro b/src/controls/controls.pro
index f725b1ce..6493eadb 100644
--- a/src/controls/controls.pro
+++ b/src/controls/controls.pro
@@ -54,32 +54,37 @@ include(Styles/styles.pri)
osx: LIBS_PRIVATE += -framework Carbon
-# Create the resource file
-GENERATED_RESOURCE_FILE = $$OUT_PWD/controls.qrc
-
-INCLUDED_RESOURCE_FILES = \
- $$CONTROLS_QML_FILES \
- $$PRIVATE_QML_FILES \
- $$STYLES_QML_FILES
-
-RESOURCE_CONTENT = \
- "<RCC>" \
- "<qresource prefix=\"/QtQuick/Controls\">"
-
-for(resourcefile, INCLUDED_RESOURCE_FILES) {
- resourcefileabsolutepath = $$absolute_path($$resourcefile)
- relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
- relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
- RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
+!static {
+ # Create the resource file
+ GENERATED_RESOURCE_FILE = $$OUT_PWD/controls.qrc
+
+ INCLUDED_RESOURCE_FILES = \
+ $$CONTROLS_QML_FILES \
+ $$PRIVATE_QML_FILES \
+ $$STYLES_QML_FILES
+
+ RESOURCE_CONTENT = \
+ "<RCC>" \
+ "<qresource prefix=\"/QtQuick/Controls\">"
+
+ for(resourcefile, INCLUDED_RESOURCE_FILES) {
+ resourcefileabsolutepath = $$absolute_path($$resourcefile)
+ relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
+ relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
+ RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
+ }
+
+ RESOURCE_CONTENT += \
+ "</qresource>" \
+ "</RCC>"
+
+ write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
+
+ RESOURCES += $$GENERATED_RESOURCE_FILE
+} else {
+ QML_FILES += $$CONTROLS_QML_FILES \
+ $$PRIVATE_QML_FILES \
+ $$STYLES_QML_FILES
}
-
-RESOURCE_CONTENT += \
- "</qresource>" \
- "</RCC>"
-
-write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
-
-RESOURCES += $$GENERATED_RESOURCE_FILE
-
CONFIG += no_cxx_module
load(qml_plugin)
diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp
index bb37692c..53ca9075 100644
--- a/src/controls/plugin.cpp
+++ b/src/controls/plugin.cpp
@@ -73,7 +73,11 @@
static void initResources()
{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Controls);
+#else
Q_INIT_RESOURCE(controls);
+#endif
}
QT_BEGIN_NAMESPACE
@@ -121,9 +125,13 @@ static const struct {
{ "TreeView", 1, 5 }
};
-void QtQuickControlsPlugin::registerTypes(const char *uri)
+QtQuickControlsPlugin::QtQuickControlsPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
{
initResources();
+}
+
+void QtQuickControlsPlugin::registerTypes(const char *uri)
+{
qmlRegisterType<QQuickAction>(uri, 1, 0, "Action");
qmlRegisterType<QQuickExclusiveGroup1>(uri, 1, 0, "ExclusiveGroup");
qmlRegisterType<QQuickMenuItem1>(uri, 1, 0, "MenuItem");
@@ -188,13 +196,22 @@ void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri
QString QtQuickControlsPlugin::fileLocation() const
{
+#ifndef QT_STATIC
if (isLoadedFromResource())
return "qrc:/QtQuick/Controls";
return baseUrl().toString();
+#else
+ return "qrc:/qt-project.org/imports/QtQuick/Controls";
+#endif
}
bool QtQuickControlsPlugin::isLoadedFromResource() const
{
+#ifdef QT_STATIC
+ // When static it is included automatically
+ // for us.
+ return false;
+#endif
#if defined(ALWAYS_LOAD_FROM_RESOURCES)
return true;
#else
diff --git a/src/controls/plugin.h b/src/controls/plugin.h
index 47dc3b06..77cee03f 100644
--- a/src/controls/plugin.h
+++ b/src/controls/plugin.h
@@ -55,6 +55,7 @@ class QtQuickControlsPlugin: public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtQuickControlsPlugin(QObject *parent = 0);
void registerTypes(const char *uri);
void initializeEngine(QQmlEngine *engine, const char *uri);
private: