aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlprivate.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-11-02 12:15:40 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-11-02 14:00:29 +0100
commit50ba4ffdf48461d38f4dd2137a0fbbc916c9eb0a (patch)
tree6caac8e7a67d27f0a9025523ec6e6a418196740a /src/qml/qml/qqmlprivate.h
parente826636a0bebd0d73e6c17038b24ee2a42d92ead (diff)
QML: Allow singleton types to be extended
It seems we never stated that singletons can not be extended in our documentation. Therefore this is technically a bug fix and doesn't need separate documentation. Change-Id: I7877289bd5a52ecf709f80ba1975137981ec65f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlprivate.h')
-rw-r--r--src/qml/qml/qqmlprivate.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index 4fcfd65c09..19072f0751 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -526,6 +526,10 @@ namespace QQmlPrivate
const QMetaObject *instanceMetaObject;
QMetaType typeId;
+
+ QObject *(*extensionObjectCreate)(QObject *);
+ const QMetaObject *extensionMetaObject;
+
QTypeRevision revision;
};
@@ -540,6 +544,10 @@ namespace QQmlPrivate
const QMetaObject *classInfoMetaObject;
QMetaType typeId;
+
+ QObject *(*extensionObjectCreate)(QObject *);
+ const QMetaObject *extensionMetaObject;
+
QVector<int> *qmlTypeIds;
};
@@ -752,10 +760,10 @@ namespace QQmlPrivate
}
};
- template<typename T>
+ template<typename T, typename E>
void qmlRegisterSingletonAndRevisions(const char *uri, int versionMajor,
const QMetaObject *classInfoMetaObject,
- QVector<int> *qmlTypeIds)
+ QVector<int> *qmlTypeIds, const QMetaObject *extension)
{
RegisterSingletonTypeAndRevisions api = {
0,
@@ -769,6 +777,10 @@ namespace QQmlPrivate
classInfoMetaObject,
QmlMetaType<T>::self(),
+
+ ExtendedType<E>::createParent,
+ extension ? extension : ExtendedType<E>::staticMetaObject(),
+
qmlTypeIds
};