aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloaderthread.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-10-01 14:43:37 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-10-14 10:42:29 +0200
commitee62b2824fe91e95a3f8218b93ba55a2ef6660d0 (patch)
treeff403362ee4b73c9d90c640d29bf22a0aba94c23 /src/qml/qml/qqmltypeloaderthread.cpp
parent8cb08ca42157bb43b523103a6d1be94534be0597 (diff)
Add support for semi-automatic QML type registrations
We can use the new moc JSON output to collect all meta-objects at build time and, for those that include QML element registration meta-data, generate code that automatically registers these types with QML. This eliminates the need to call qmlRegisterType manually. For now this generates free-standing functions (per module) that need to be called manually. This is intended as an intermediate step. Task-number: QTBUG-68796 Change-Id: Ib414eef9757344feee488ebc7388f957b975347f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloaderthread.cpp')
-rw-r--r--src/qml/qml/qqmltypeloaderthread.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/qml/qml/qqmltypeloaderthread.cpp b/src/qml/qml/qqmltypeloaderthread.cpp
index 0e1cecd1e5..618bb09039 100644
--- a/src/qml/qml/qqmltypeloaderthread.cpp
+++ b/src/qml/qml/qqmltypeloaderthread.cpp
@@ -138,7 +138,13 @@ void QQmlTypeLoaderThread::callDownloadProgressChanged(QQmlDataBlob *b, qreal p)
void QQmlTypeLoaderThread::initializeEngine(QQmlExtensionInterface *iface,
const char *uri)
{
- callMethodInMain(&This::initializeEngineMain, iface, uri);
+ callMethodInMain(&This::initializeExtensionMain, iface, uri);
+}
+
+void QQmlTypeLoaderThread::initializeEngine(QQmlEngineExtensionInterface *iface,
+ const char *uri)
+{
+ callMethodInMain(&This::initializeEngineExtensionMain, iface, uri);
}
void QQmlTypeLoaderThread::shutdownThread()
@@ -188,7 +194,14 @@ void QQmlTypeLoaderThread::callDownloadProgressChangedMain(QQmlDataBlob *b, qrea
b->release();
}
-void QQmlTypeLoaderThread::initializeEngineMain(QQmlExtensionInterface *iface,
+void QQmlTypeLoaderThread::initializeExtensionMain(QQmlExtensionInterface *iface,
+ const char *uri)
+{
+ Q_ASSERT(m_loader->engine()->thread() == QThread::currentThread());
+ iface->initializeEngine(m_loader->engine(), uri);
+}
+
+void QQmlTypeLoaderThread::initializeEngineExtensionMain(QQmlEngineExtensionInterface *iface,
const char *uri)
{
Q_ASSERT(m_loader->engine()->thread() == QThread::currentThread());