diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-08 13:59:15 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-09-08 19:16:24 +0000 |
commit | f604543d53b98370b0a12953a889fc971c983522 (patch) | |
tree | 5172019572f45736f2dda2b21b24ddf2f8292fe6 /src | |
parent | 64fba2938ab08c12936d3b0d12c34f1bedb98e89 (diff) |
Fix alias to inline component type
When we create an alias property, we resolve its targets metatype. In
the case of inline components of the same file, that's however not
possible via QQmlType, as the type will only be available once the outer
type has been fully set up.
Fix this by looking up the type in the ExecutableCompilationUnit, where
the information is available while the type registraiton process is still
ongoing.
As a drive-by, also set the alias flag correctly when constructing the
QMetaObject of a QML element.
Fixes: QTBUG-106392
Change-Id: Ie8f55dd0894cc5c8d683dd3c685980878956d3ca
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 2a37ff2f49140272d0122ccc097cc14c2fa4133e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycachecreator_p.h | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 5b44ead713..278977fb9c 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -1038,6 +1038,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const property.setWritable(data->isWritable()); property.setResettable(data->isResettable()); property.setBindable(data->isBindable()); + property.setAlias(data->isAlias()); } for (int ii = 0; ii < methods.count(); ++ii) { diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h index c8d516b367..09d8ace425 100644 --- a/src/qml/qml/qqmlpropertycachecreator_p.h +++ b/src/qml/qml/qqmlpropertycachecreator_p.h @@ -945,10 +945,16 @@ inline QQmlError QQmlPropertyCacheAliasCreator<ObjectContainer>::propertyDataFor } const auto referencedType = typeRef->type(); - if (referencedType.isValid()) + if (referencedType.isValid()) { *type = referencedType.typeId(); - else + if (!type->isValid() && referencedType.isInlineComponentType()) { + int objectId = referencedType.inlineComponentId(); + *type = objectContainer->typeIdsForComponent(objectId).id; + Q_ASSERT(type->isValid()); + } + } else { *type = typeRef->compilationUnit()->typeIds.id; + } *version = typeRef->version(); |