aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/workerscript
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-01-13 17:13:33 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-01-14 14:53:10 +0100
commit00767c78ec45dd793c2c30404c0232c68a9aa863 (patch)
tree9f558732248f56b4935345c670929ed47735a8e0 /src/imports/workerscript
parent8a22c92b55b5d015e372fe5be0633c3935af4218 (diff)
WorkerScript and QmlModels plugins: Force linking of base modules
We need to access some symbol from QtQmlWorkerScript or QtQmlModels, repsectively, so that the linker doesn't optimize the dependency out. Otherwise the QML types won't be loaded and we can in fact not create worker scripts or models. Change-Id: Ibd665baf8552e08216eb203c8493300c1773cb29 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/imports/workerscript')
-rw-r--r--src/imports/workerscript/plugin.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/imports/workerscript/plugin.cpp b/src/imports/workerscript/plugin.cpp
index b2f8e6b3bc..0961979c53 100644
--- a/src/imports/workerscript/plugin.cpp
+++ b/src/imports/workerscript/plugin.cpp
@@ -37,11 +37,17 @@
**
****************************************************************************/
+#include <QtQmlWorkerScript/private/qquickworkerscript_p.h>
+
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
+#include <QtCore/qloggingcategory.h>
+
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(workerScriptPlugin, "qt.workerScriptPlugin")
+
/*!
\qmlmodule QtQml.WorkerScript 2.\QtMinorVersion
\title Qt QML WorkerScript QML Types
@@ -63,7 +69,16 @@ class QtQmlWorkerScriptPlugin : public QQmlEngineExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) { }
+ QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
+ {
+ if (workerScriptPlugin().isDebugEnabled()) {
+ // Superficial debug message that causes the dependency between QtQmlWorkerScript
+ // and the workerscript plugin to be retained.
+ // As qCDebug() can be a noop, retrieve the className in a separate step.
+ const QString className = QQuickWorkerScript::staticMetaObject.className();
+ qCDebug(workerScriptPlugin) << "Loading WorkerScript plugin:" << className;
+ }
+ }
};
QT_END_NAMESPACE