diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2022-05-17 09:36:52 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2022-05-24 10:30:48 +0200 |
commit | ff0b9ec6bf817f741e3c9fefbfcd55592e9b2542 (patch) | |
tree | 07afd8fdc171af980ca9c4ec8b8e8fad9638f73c /src/qml/qml/qqmlmetatype_p.h | |
parent | c02dd17a4f648ec18c6ff2ae7bfe468bd9c42732 (diff) |
Revise QQmlProxyMetaObject and extension chain creation
Clone the full-ish meta object hierarchy when dealing with extensions:
that way we guarantee that shadowing works correctly both ways -
extension properties can shadow type properties AND type properties
can shadow extension properties (the latter happens when extension
belongs to a base type). This was impossible before since we would
always put extension proxies on top of the meta object chain,
regardless of where in the chain extensions are located. Consider:
"C -> B + ExtensionB -> A + ExtensionA" is interpreted as
(old) ExtensionB -> ExtensionA -> C -> B -> A
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^
cloned meta objects static meta objects
(new) C -> ExtensionB -> B -> ExtensionA -> A -> C -> B -> A
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^
cloned meta objects static meta objects
One can notice that we now clone _more_ meta objects: this is to
be able to to create a chain with correctly ordered properties
Unify the proxy data creation under QQmlMetaType::proxyData()
Update QQmlProxyMetaObject which now has to deal with different types
of proxies: not only extensions but also "cloned" self. CustomCall
metaCall() of QQmlProxyMetaObject is also adjusted to ignore
non-extensions
Change-Id: I40e1547a9c05a8504ab98bc06a6bc412a2460783
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype_p.h')
-rw-r--r-- | src/qml/qml/qqmlmetatype_p.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index b9bf78b0a7..11e397da2a 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -256,17 +256,20 @@ public: static int registerUnitCacheHook(const QQmlPrivate::RegisterQmlUnitCacheHook &hookRegistration); static void clearTypeRegistrations(); - static QList<QQmlProxyMetaObject::ProxyData> proxyData(const QMetaObject *mo, - const QMetaObject *baseMetaObject, - QMetaObject *lastMetaObject); + static QList<QQmlProxyMetaObject::ProxyData> + proxyData(QQmlTypePrivate *type, const QMetaObject *mo, const QMetaObject *baseMetaObject); enum ClonePolicy { CloneAll, // default CloneEnumsOnly, // skip properties and methods }; + enum CloneTarget { + CloneTargetExtension, + CloneTargetObject, + }; static void clone(QMetaObjectBuilder &builder, const QMetaObject *mo, const QMetaObject *ignoreStart, const QMetaObject *ignoreEnd, - ClonePolicy policy); + ClonePolicy policy, CloneTarget target); static void qmlInsertModuleRegistration(const QString &uri, void (*registerFunction)()); static void qmlRemoveModuleRegistration(const QString &uri); |