diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-04-26 10:34:31 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-06-13 10:17:05 +0200 |
commit | 20d53f3059df48d4dc3dd6137a226211440bd988 (patch) | |
tree | 05da24107c459028cd2ab46f5a7b1fabc3065708 /src/qml | |
parent | b13b9540146b00a4afe187e3f6a1e6501c41e776 (diff) |
QQmlTypeCompiler: Find implicit components for inline component roots
Fixes: QTBUG-102719
Change-Id: Ia6654f617d9d0922c94a5e204f9559e95c529641
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 95837745e4123a9ba49948daefcc0d87969d1cec)
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmltypecompiler.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp index 8d0e486b53..03c72c3f41 100644 --- a/src/qml/qml/qqmltypecompiler.cpp +++ b/src/qml/qml/qqmltypecompiler.cpp @@ -870,7 +870,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI } } -// resolve ignores everything relating to inline components +// Resolve ignores everything relating to inline components, except for implicit components. bool QQmlComponentAndAliasResolver::resolve(int root) { // Detect real Component {} objects as well as implicitly defined components, such as @@ -881,28 +881,35 @@ bool QQmlComponentAndAliasResolver::resolve(int root) const int startObjectIndex = root == 0 ? root : root+1; // root+1, as ic root is handled at the end for (int i = startObjectIndex; i < objCountWithoutSynthesizedComponents; ++i) { QmlIR::Object *obj = qmlObjects->at(i); - if (root == 0) { - // normal component root, skip over anything inline component related - if (obj->isInlineComponent || obj->flags & QV4::CompiledData::Object::InPartOfInlineComponent) { - continue; - } - } else { - if (!(obj->flags & QV4::CompiledData::Object::InPartOfInlineComponent) || - obj->flags & QV4::CompiledData::Object::IsInlineComponentRoot) - break; // left current inline component (potentially entered a new one) - } - QQmlPropertyCache *cache = propertyCaches.at(i); - if (obj->inheritedTypeNameIndex == 0 && !cache) - continue; + const bool isInlineComponentRoot + = obj->flags & QV4::CompiledData::Object::IsInlineComponentRoot; + const bool isPartOfInlineComponent + = obj->flags & QV4::CompiledData::Object::InPartOfInlineComponent; + QQmlPropertyCache *cache = propertyCaches.at(i); bool isExplicitComponent = false; - if (obj->inheritedTypeNameIndex) { auto *tref = resolvedType(obj->inheritedTypeNameIndex); Q_ASSERT(tref); if (tref->type().metaObject() == &QQmlComponent::staticMetaObject) isExplicitComponent = true; } + + if (root == 0) { + // normal component root, skip over anything inline component related + if (isInlineComponentRoot || isPartOfInlineComponent) + continue; + } else if (!isPartOfInlineComponent || isInlineComponentRoot) { + // We've left the current inline component (potentially entered a new one), + // but we still need to resolve implicit components which are part of inline components. + if (cache && !isExplicitComponent) + findAndRegisterImplicitComponents(obj, cache); + break; + } + + if (obj->inheritedTypeNameIndex == 0 && !cache) + continue; + if (!isExplicitComponent) { if (cache) findAndRegisterImplicitComponents(obj, cache); |