diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-28 15:59:15 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-03-11 14:48:35 +0100 |
commit | 547b4d2c2d9424fdcc694e291fe543a4f52cb684 (patch) | |
tree | 5beb7cef439c16d86dcc5e682332e5a487b2aaea /src/qml/qml/qqml.cpp | |
parent | 9bd034ea01d01dcc4598c3e3e25e91d0b53a2cda (diff) |
Optionally return type IDs from qmlRegisterTypeAndRevisions()
This allows us to save the type IDs and later unregister the types in
qmltyperegistrar-generated code.
Change-Id: Id1bc73e2832c6d76e513ee3ee267b8d52e3851da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r-- | src/qml/qml/qqml.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index 20dd3827c5..79f853487c 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -253,7 +253,9 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data) assignVersions(&revisionRegistration, revision, type.version); revisionRegistration.customParser = type.customParserFactory(); - qmlregister(TypeRegistration, &revisionRegistration); + const int id = qmlregister(TypeRegistration, &revisionRegistration); + if (type.qmlTypeIds) + type.qmlTypeIds->append(id); } break; } @@ -301,7 +303,9 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data) } assignVersions(&revisionRegistration, revision, type.version); - qmlregister(SingletonRegistration, &revisionRegistration); + const int id = qmlregister(SingletonRegistration, &revisionRegistration); + if (type.qmlTypeIds) + type.qmlTypeIds->append(id); } break; } @@ -362,7 +366,8 @@ void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data) namespace QQmlPrivate { template<> void qmlRegisterTypeAndRevisions<QQmlTypeNotAvailable, void>( - const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject) + const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, + QVector<int> *qmlTypeIds) { using T = QQmlTypeNotAvailable; @@ -386,7 +391,7 @@ namespace QQmlPrivate { StaticCastSelector<T, QQmlPropertyValueSource>::cast(), StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(), - nullptr, nullptr, qmlCreateCustomParser<T> + nullptr, nullptr, qmlCreateCustomParser<T>, qmlTypeIds }; qmlregister(TypeAndRevisionsRegistration, &type); |