aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/workerscript/plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/workerscript/plugin.cpp')
-rw-r--r--src/imports/workerscript/plugin.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/imports/workerscript/plugin.cpp b/src/imports/workerscript/plugin.cpp
index 2d8797db7e..0961979c53 100644
--- a/src/imports/workerscript/plugin.cpp
+++ b/src/imports/workerscript/plugin.cpp
@@ -37,12 +37,17 @@
**
****************************************************************************/
-#include <QtQmlWorkerScript/private/qqmlworkerscriptmodule_p.h>
+#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
@@ -59,19 +64,20 @@ QT_BEGIN_NAMESPACE
\endqml
*/
-class QtQmlWorkerScriptPlugin : public QQmlExtensionPlugin
+class QtQmlWorkerScriptPlugin : public QQmlEngineExtensionPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+ Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid)
public:
- QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
+ QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent)
{
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml.WorkerScript"));
-
- QQmlWorkerScriptModule::defineModule();
-
- qmlRegisterModule(uri, 2, 15);
+ 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;
+ }
}
};