diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-02 12:15:07 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-03 08:20:52 +0100 |
commit | 8762e2fb681acb2947d2dd7243da12e546582723 (patch) | |
tree | 494fe7a9c78498988b2639cc2149e5b4edad07c1 /src/qml/qml/qqmlproperty.cpp | |
parent | 05bf2f293a952eac7a41279815bf3480aa067586 (diff) |
QQmlTypeNameCache: Unify querying for types
Template all of the code and make sure the different query variants do
the same work. There is no reason not to query the namespaced imports if
we are passed a different string type as parameter. If we want to skip
the namespaced imports, that is a separate parameter.
This needs to be picked to 6.2 as precondition for fixing
AOTCompiledContext::initLoadAttachedLookup. We need to pass a
QQmlImport::RecursionRestriction when querying by QHashedStringRef.
Pick-to: 6.2
Change-Id: I98aecc7775036728668cc93f550aa73fdefafe9a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 825a2cfc8a..02a18164ab 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -295,17 +295,24 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, currentObject = qmlAttachedPropertiesObject(currentObject, func); if (!currentObject) return; // Something is broken with the attachable type } else if (r.importNamespace) { - if ((ii + 1) == path.count()) return; // No type following the namespace + if (++ii == path.count()) + return; // No type following the namespace - ++ii; r = typeNameCache->query(path.at(ii), r.importNamespace); - if (!r.type.isValid()) return; // Invalid type in namespace + // TODO: Do we really _not_ want to query the namespaced types here? + r = typeNameCache->query<QQmlTypeNameCache::QueryNamespaced::No>( + path.at(ii), r.importNamespace); + + if (!r.type.isValid()) + return; // Invalid type in namespace QQmlEnginePrivate *enginePrivate = QQmlEnginePrivate::get(engine); QQmlAttachedPropertiesFunc func = r.type.attachedPropertiesFunction(enginePrivate); - if (!func) return; // Not an attachable type + if (!func) + return; // Not an attachable type currentObject = qmlAttachedPropertiesObject(currentObject, func); - if (!currentObject) return; // Something is broken with the attachable type + if (!currentObject) + return; // Something is broken with the attachable type } else if (r.scriptIndex != -1) { return; // Not a type |