diff options
author | Ulf Hermann <[email protected]> | 2023-05-26 11:40:31 +0200 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2023-05-26 17:12:04 +0200 |
commit | 94316b4fb090e3145ec7461faa7f516650576d3c (patch) | |
tree | 5bc58446b81c456fedfbc36c57ff9e4b2b8e13f3 /src/qml/jsruntime/qv4executablecompilationunit_p.h | |
parent | 4ffea9dd1617aeaf6efaeb0d9a361848e34dbd11 (diff) |
QQmlComponent: Resolve inline components by name rather than ID
We can always easily determine the name. In order to determine the ID,
we first have to compile the outer component.
Change-Id: Idd87d6a3dd35069cbd2fe2d99b1f69d15c53832a
Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit_p.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit_p.h b/src/qml/jsruntime/qv4executablecompilationunit_p.h index e35c00c8bb..3a0efa467e 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit_p.h +++ b/src/qml/jsruntime/qv4executablecompilationunit_p.h @@ -150,6 +150,19 @@ public: QHash<int, InlineComponentData> inlineComponentData; + int inlineComponentId(const QString &inlineComponentName) const + { + for (int i = 0; i < objectCount(); ++i) { + auto *object = objectAt(i); + for (auto it = object->inlineComponentsBegin(), end = object->inlineComponentsEnd(); + it != end; ++it) { + if (stringAt(it->nameIndex) == inlineComponentName) + return it->objectIndex; + } + } + return -1; + } + std::unique_ptr<CompilationUnitMapper> backingFile; // --- interface for QQmlPropertyCacheCreator |