diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-25 13:56:24 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-01-25 16:53:32 +0100 |
commit | 79ac5a2053c09246860d61a9d5124d89d0b30abd (patch) | |
tree | ea67dc128b323c6147b866877a10b296968f58fa /src/qml | |
parent | be26ca6bcaaf0ddd7337cb8ff856a2e97866278a (diff) |
qmltyperegistrar: Make sure we have metatypes for all QML types
We need to be able to resolve any QML type from its C++ name using
QMetaType::fromName(). qmltyperegistrar can generate the missing
metatypes, either by creating synthetic ones (for namespaces), or by
making sure the existing ones are registered (for others).
Change-Id: If775af56d891f2c2a5bb94589b3cb05a199c7c35
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmlprivate.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index 1b994b88e1..608a0f0188 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -904,6 +904,30 @@ namespace QQmlPrivate const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QVector<int> *qmlTypeIds, const QMetaObject *); + constexpr QtPrivate::QMetaTypeInterface metaTypeForNamespace( + const QtPrivate::QMetaTypeInterface::MetaObjectFn &metaObjectFunction, const char *name) + { + return { + /*.revision=*/ 0, + /*.alignment=*/ 0, + /*.size=*/ 0, + /*.flags=*/ 0, + /*.typeId=*/ {}, + /*.metaObject=*/ metaObjectFunction, + /*.name=*/ name, + /*.defaultCtr=*/ nullptr, + /*.copyCtr=*/ nullptr, + /*.moveCtr=*/ nullptr, + /*.dtor=*/ nullptr, + /*.equals*/ nullptr, + /*.lessThan*/ nullptr, + /*.debugStream=*/ nullptr, + /*.dataStreamOut=*/ nullptr, + /*.dataStreamIn=*/ nullptr, + /*.legacyRegisterOp=*/ nullptr + }; + } + } // namespace QQmlPrivate QT_END_NAMESPACE |