diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-09 10:34:48 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-10-02 13:21:09 +0200 |
commit | d621027babff9a30d56ab6af871a465108c9eaba (patch) | |
tree | 54a5ccff0410476538929e4ab1f1400075c0df81 /src/qml/qml/qqml.h | |
parent | ed7719a3af58b9ba36a6fbaccd08c85b78f8a961 (diff) |
V4: Rewrite qv4sequenceobject based on QMetaSequence
This avoids the template explosion and makes the mechanism extendable.
You can now register additional anonymous sequential containers.
Fixes: QTBUG-71574
Task-number: QTBUG-82443
Change-Id: I5b9ed9af1533a3b7df8fc5bb37bbb73b8304e592
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.h')
-rw-r--r-- | src/qml/qml/qqml.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index f399924447..758b0a51cf 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -45,6 +45,7 @@ #include <QtCore/qbytearray.h> #include <QtCore/qmetaobject.h> +#include <QtCore/qmetacontainer.h> #include <QtCore/qversionnumber.h> #define QML_VERSION 0x020000 @@ -758,6 +759,21 @@ inline int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, i return QQmlPrivate::qmlregister(QQmlPrivate::CompositeRegistration, &type); } +template<typename Container> +inline int qmlRegisterAnonymousSequentialContainer(const char *uri, int versionMajor) +{ + QQmlPrivate::RegisterSequentialContainer type = { + 0, + uri, + QTypeRevision::fromMajorVersion(versionMajor), + nullptr, + QMetaType::fromType<Container>(), + QMetaSequence::fromContainer<Container>() + }; + + return QQmlPrivate::qmlregister(QQmlPrivate::SequentialContainerRegistration, &type); +} + template<class T, class Resolved, class Extended, bool Singleton, bool Interface> struct QmlTypeAndRevisionsRegistration; |