summaryrefslogtreecommitdiff
path: root/src
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
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')
-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
-rw-r--r--src/dialogs/Private/dialogsprivateplugin.cpp8
-rw-r--r--src/dialogs/dialogs.pro49
-rw-r--r--src/dialogs/plugin.cpp34
-rw-r--r--src/dialogs/qmldir1
-rw-r--r--src/extras/Private/private.pri2
-rw-r--r--src/extras/Styles/Flat/Flat.pro3
-rw-r--r--src/extras/Styles/Flat/flatstyleplugin.cpp15
-rw-r--r--src/extras/extras.pro3
-rw-r--r--src/extras/plugin.cpp14
-rw-r--r--src/widgets/widgetsplugin.cpp8
16 files changed, 174 insertions, 64 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:
diff --git a/src/dialogs/Private/dialogsprivateplugin.cpp b/src/dialogs/Private/dialogsprivateplugin.cpp
index 769dc892..e9b39e05 100644
--- a/src/dialogs/Private/dialogsprivateplugin.cpp
+++ b/src/dialogs/Private/dialogsprivateplugin.cpp
@@ -42,6 +42,13 @@
#include "qquickwritingsystemlistmodel_p.h"
#include "qquickfontlistmodel_p.h"
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Dialogs_Private);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class QtQuick2DialogsPrivatePlugin : public QQmlExtensionPlugin
@@ -50,6 +57,7 @@ class QtQuick2DialogsPrivatePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtQuick2DialogsPrivatePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs.Private"));
diff --git a/src/dialogs/dialogs.pro b/src/dialogs/dialogs.pro
index 9daaa6e6..f19283f2 100644
--- a/src/dialogs/dialogs.pro
+++ b/src/dialogs/dialogs.pro
@@ -80,29 +80,32 @@ ios|android|blackberry|winrt {
QT += quick-private gui gui-private core core-private qml qml-private
-# Create the resource file
-GENERATED_RESOURCE_FILE = $$OUT_PWD/dialogs.qrc
-
-RESOURCE_CONTENT = \
- "<RCC>" \
- "<qresource prefix=\"/QtQuick/Dialogs\">"
-
-for(resourcefile, DIALOGS_QML_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/dialogs.qrc
+
+ RESOURCE_CONTENT = \
+ "<RCC>" \
+ "<qresource prefix=\"/QtQuick/Dialogs\">"
+
+ for(resourcefile, DIALOGS_QML_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
+ # In case of a debug build, deploy the QML files too
+ !qtquickcompiler:CONFIG(debug, debug|release): QML_FILES += $$DIALOGS_QML_FILES
+} else {
+ QML_FILES += $$DIALOGS_QML_FILES
}
-RESOURCE_CONTENT += \
- "</qresource>" \
- "</RCC>"
-
-write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
-
-RESOURCES += $$GENERATED_RESOURCE_FILE
-
-# In case of a debug build, deploy the QML files too
-!qtquickcompiler:CONFIG(debug, debug|release): QML_FILES += $$DIALOGS_QML_FILES
-
load(qml_plugin)
diff --git a/src/dialogs/plugin.cpp b/src/dialogs/plugin.cpp
index e6ce5a6f..ddc3fad5 100644
--- a/src/dialogs/plugin.cpp
+++ b/src/dialogs/plugin.cpp
@@ -64,7 +64,11 @@ Q_LOGGING_CATEGORY(lcRegistration, "qt.quick.dialogs.registration")
static void initResources()
{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Dialogs);
+#else
Q_INIT_RESOURCE(dialogs);
+#endif
}
QT_BEGIN_NAMESPACE
@@ -90,7 +94,7 @@ class QtQuick2DialogsPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
- QtQuick2DialogsPlugin() : QQmlExtensionPlugin(), m_useResources(true) { }
+ QtQuick2DialogsPlugin() : QQmlExtensionPlugin(), m_useResources(true) { initResources(); }
virtual void initializeEngine(QQmlEngine *engine, const char * uri) {
qCDebug(lcRegistration) << uri << m_decorationComponentUrl;
@@ -99,16 +103,18 @@ public:
}
virtual void registerTypes(const char *uri) {
- initResources();
-
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs"));
bool hasTopLevelWindows = QGuiApplicationPrivate::platformIntegration()->
hasCapability(QPlatformIntegration::MultipleWindows);
qCDebug(lcRegistration) << uri << "can use top-level windows?" << hasTopLevelWindows;
QDir qmlDir(baseUrl().toLocalFile());
QDir widgetsDir(baseUrl().toLocalFile());
+#ifndef QT_STATIC
widgetsDir.cd("../PrivateWidgets");
-
+#endif
+#ifdef QT_STATIC
+ m_useResources = false;
+#else
#ifndef ALWAYS_LOAD_FROM_RESOURCES
// If at least one file was actually installed, then use installed qml files instead of resources.
// This makes debugging and incremental development easier, whereas the "normal" installation
@@ -116,10 +122,14 @@ public:
if (qmlDir.exists(QString("DefaultFileDialog.qml")))
m_useResources = false;
#endif
+#endif
m_decorationComponentUrl = m_useResources ?
QUrl("qrc:/QtQuick/Dialogs/qml/DefaultWindowDecoration.qml") :
+#ifndef QT_STATIC
QUrl::fromLocalFile(qmlDir.filePath(QString("qml/DefaultWindowDecoration.qml")));
-
+#else
+ QUrl("qrc:/qt-project.org/imports/QtQuick/Dialogs/qml/DefaultWindowDecoration.qml");
+#endif
// Prefer the QPA dialog helpers if the platform supports them.
// Else if there is a QWidget-based implementation, check whether it's
// possible to instantiate it from Qt Quick.
@@ -170,7 +180,11 @@ public:
qmlRegisterType<QQuickDialog>(uri, 1, 2, "AbstractDialog"); // implementation wrapper
QUrl dialogQmlPath = m_useResources ?
QUrl("qrc:/QtQuick/Dialogs/DefaultDialogWrapper.qml") :
+#ifndef QT_STATIC
QUrl::fromLocalFile(qmlDir.filePath("DefaultDialogWrapper.qml"));
+#else
+ QUrl("qrc:/qt-project.org/imports/QtQuick/Dialogs/DefaultDialogWrapper.qml");
+#endif
qCDebug(lcRegistration) << " registering" << dialogQmlPath << "as Dialog";
qmlRegisterType(dialogQmlPath, uri, 1, 2, "Dialog");
}
@@ -217,7 +231,11 @@ protected:
QCoreApplication::instance()->inherits("QApplication")) {
QUrl dialogQmlPath = m_useResources ?
QUrl(QString("qrc:/QtQuick/Dialogs/Widget%1.qml").arg(qmlName)) :
- QUrl::fromLocalFile(qmlDir.filePath(QString("Widget%1.qml").arg(qmlName)));
+#ifndef QT_STATIC
+ QUrl::fromLocalFile(qmlDir.filePath(QString("Widget%1.qml").arg(qmlName)));
+#else
+ QUrl(QString("qrc:/qt-project.org/imports/QtQuick/Dialogs/Widget%1.qml").arg(qmlName));
+#endif
if (qmlRegisterType(dialogQmlPath, uri, versionMajor, versionMinor, qmlName) >= 0) {
qCDebug(lcRegistration) << " registering" << qmlName << " as " << dialogQmlPath;
return true;
@@ -235,7 +253,11 @@ protected:
qmlRegisterType<WrapperType>(uri, versionMajor, versionMinor, abstractTypeName);
QUrl dialogQmlPath = m_useResources ?
QUrl(QString("qrc:/QtQuick/Dialogs/Default%1.qml").arg(qmlName)) :
+#ifndef QT_STATIC
QUrl::fromLocalFile(qmlDir.filePath(QString("Default%1.qml").arg(qmlName)));
+#else
+ QUrl(QString("qrc:/qt-project.org/imports/QtQuick/Dialogs/Default%1.qml").arg(qmlName));
+#endif
qCDebug(lcRegistration) << " registering" << qmlName << " as " << dialogQmlPath;
qmlRegisterType(dialogQmlPath, uri, versionMajor, versionMinor, qmlName);
}
diff --git a/src/dialogs/qmldir b/src/dialogs/qmldir
index 03186563..e94f11dd 100644
--- a/src/dialogs/qmldir
+++ b/src/dialogs/qmldir
@@ -6,3 +6,4 @@ depends Qt.labs.folderlistmodel 1.0
depends Qt.labs.settings 1.0
depends QtQuick.Dialogs.Private 1.0
depends QtQuick.Controls 1.3
+depends QtQuick.PrivateWidgets 1.1
diff --git a/src/extras/Private/private.pri b/src/extras/Private/private.pri
index 0e4f7a12..f0c31caa 100644
--- a/src/extras/Private/private.pri
+++ b/src/extras/Private/private.pri
@@ -12,7 +12,7 @@ SOURCES += \
$$PWD/qquickmousethief.cpp \
$$PWD/qquickmathutils.cpp
-OTHER_FILES += \
+QML_FILES += \
$$PWD/qmldir \
$$PWD/CircularButton.qml \
$$PWD/CircularButtonStyleHelper.qml \
diff --git a/src/extras/Styles/Flat/Flat.pro b/src/extras/Styles/Flat/Flat.pro
index 6f70c7a8..079c3cf5 100644
--- a/src/extras/Styles/Flat/Flat.pro
+++ b/src/extras/Styles/Flat/Flat.pro
@@ -61,7 +61,8 @@ FLAT_STYLE += \
$$PWD/fonts/OpenSans-Semibold.ttf \
$$PWD/fonts/LICENSE.txt \
-RESOURCES += flatstyle.qrc
+!static:RESOURCES += flatstyle.qrc
+else: QML_FILES += $$FLAT_STYLE
CONFIG += no_cxx_module
load(qml_plugin)
diff --git a/src/extras/Styles/Flat/flatstyleplugin.cpp b/src/extras/Styles/Flat/flatstyleplugin.cpp
index d9a30d34..5d88134b 100644
--- a/src/extras/Styles/Flat/flatstyleplugin.cpp
+++ b/src/extras/Styles/Flat/flatstyleplugin.cpp
@@ -47,9 +47,14 @@
static void initResources()
{
+#ifndef QT_STATIC
Q_INIT_RESOURCE(flatstyle);
+#else
+ Q_INIT_RESOURCE(qmake_QtQuick_Controls_Styles_Flat);
+#endif
}
+#ifndef QT_STATIC
extern "C" {
Q_DECL_EXPORT bool qt_quick_controls_style_init()
{
@@ -62,19 +67,23 @@ extern "C" {
return ":/ExtrasImports/QtQuick/Controls/Styles/Flat";
}
}
+#endif
QT_BEGIN_NAMESPACE
QtQuickExtrasStylesPlugin::QtQuickExtrasStylesPlugin(QObject *parent) :
QQmlExtensionPlugin(parent)
{
+ initResources();
}
void QtQuickExtrasStylesPlugin::registerTypes(const char *uri)
{
- initResources();
-
- const QString prefix = "qrc:/ExtrasImports/QtQuick/Controls/Styles/Flat/";
+#ifndef QT_STATIC
+ const QString prefix = "qrc:///ExtrasImports/QtQuick/Controls/Styles/Flat/";
+#else
+ const QString prefix = "qrc:/qt-project.org/imports/QtQuick/Controls/Styles/Flat/";
+#endif
// register version 1.0
qmlRegisterSingletonType(QUrl(prefix + "FlatStyle.qml"), uri, 1, 0, "FlatStyle");
qmlRegisterType(QUrl(prefix + "ApplicationWindowStyle.qml"), uri, 1, 0, "ApplicationWindowStyle");
diff --git a/src/extras/extras.pro b/src/extras/extras.pro
index 4363ce00..ab2f69cd 100644
--- a/src/extras/extras.pro
+++ b/src/extras/extras.pro
@@ -30,7 +30,8 @@ include(designer/designer.pri)
OTHER_FILES += doc/src/*
-RESOURCES += extras.qrc
+!static:RESOURCES += extras.qrc
+else: QML_FILES += $$CONTROLS_QML_FILES
TR_EXCLUDE += designer/*
diff --git a/src/extras/plugin.cpp b/src/extras/plugin.cpp
index bcbec453..960102ab 100644
--- a/src/extras/plugin.cpp
+++ b/src/extras/plugin.cpp
@@ -50,7 +50,11 @@
static void initResources()
{
+#ifndef QT_STATIC
Q_INIT_RESOURCE(extras);
+#else
+ Q_INIT_RESOURCE(qmake_QtQuick_Extras);
+#endif
}
QT_BEGIN_NAMESPACE
@@ -65,12 +69,16 @@ static QObject *registerMathUtilsSingleton(QQmlEngine *engine, QJSEngine *jsEngi
QtQuickExtrasPlugin::QtQuickExtrasPlugin(QObject *parent) :
QQmlExtensionPlugin(parent)
{
+ initResources();
}
void QtQuickExtrasPlugin::registerTypes(const char *uri)
{
- initResources();
+#ifndef QT_STATIC
const QString prefix = "qrc:///ExtrasImports/QtQuick/Extras";
+#else
+ const QString prefix = "qrc:/qt-project.org/imports/QtQuick/Extras";
+#endif
// Register public API.
qmlRegisterUncreatableType<QQuickActivationMode>(uri, 1, 0, "ActivationMode", QLatin1String("Do not create objects of type ActivationMode"));
// register 1.0
@@ -102,7 +110,11 @@ void QtQuickExtrasPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
qmlRegisterType<QQuickFlatProgressBar>("QtQuick.Extras.Private.CppUtils", 1, 1, "FlatProgressBar");
qmlRegisterSingletonType<QQuickMathUtils>("QtQuick.Extras.Private.CppUtils", 1, 0, "MathUtils", registerMathUtilsSingleton);
+#ifndef QT_STATIC
const QString prefix = "qrc:///ExtrasImports/QtQuick/Extras";
+#else
+ const QString prefix = "qrc:/qt-project.org/imports/QtQuick/Extras";
+#endif
const char *private_uri = "QtQuick.Extras.Private";
qmlRegisterType(QUrl(prefix + "/Private/CircularButton.qml"), private_uri, 1, 0, "CircularButton");
qmlRegisterType(QUrl(prefix + "/Private/CircularButtonStyleHelper.qml"), private_uri, 1, 0, "CircularButtonStyleHelper");
diff --git a/src/widgets/widgetsplugin.cpp b/src/widgets/widgetsplugin.cpp
index 7703f679..cb4fe8f8 100644
--- a/src/widgets/widgetsplugin.cpp
+++ b/src/widgets/widgetsplugin.cpp
@@ -44,6 +44,13 @@
#include "qquickqcolordialog_p.h"
#include "qquickqfontdialog_p.h"
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_PrivateWidgets);
+#endif
+}
+
QT_BEGIN_NAMESPACE
/*!
@@ -71,6 +78,7 @@ class QtQuick2PrivateWidgetsPlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtQuick2PrivateWidgetsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.PrivateWidgets"));