diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-04-07 13:01:53 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-04-09 09:58:04 +0200 |
commit | 06b332fe74cd2dc6ae424edc84f06ea38d5b898e (patch) | |
tree | 4d4fb18784599fa4ac07b4e8d8d6453874da1f4e /src | |
parent | 62400a6278f5f36e231f89d86e3d036f4c9e457c (diff) |
When resolving property types, also update the property type names
Otherwise we end up with a mixture of QML and C++ names.
Task-number: QTBUG-92447
Change-Id: I94c44307d8dd762d11cfd8f178f33ab6a895ee83
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4beba3a2b68a389c426791dd43c638f3539d8f20)
Diffstat (limited to 'src')
-rw-r--r-- | src/qmlcompiler/qqmljsimportvisitor.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp index 08cd9d254c..aacf95278b 100644 --- a/src/qmlcompiler/qqmljsimportvisitor.cpp +++ b/src/qmlcompiler/qqmljsimportvisitor.cpp @@ -79,6 +79,10 @@ void QQmlJSImportVisitor::resolveAliases() const auto it = m_scopesById.find(property.typeName()); if (it != m_scopesById.end()) { property.setType(QQmlJSScope::ConstPtr(*it)); + if (!it->isNull()) { + if (const QString internalName = (*it)->internalName(); !internalName.isEmpty()) + property.setTypeName(internalName); + } object->addOwnProperty(property); } } @@ -166,11 +170,17 @@ bool QQmlJSImportVisitor::visit(UiPublicMember *publicMember) } QQmlJSMetaProperty prop; prop.setPropertyName(publicMember->name.toString()); - prop.setTypeName(typeName.toString()); prop.setIsList(publicMember->typeModifier == QLatin1String("list")); prop.setIsWritable(!publicMember->isReadonlyMember); prop.setIsAlias(isAlias); - prop.setType(m_rootScopeImports.value(prop.typeName())); + const QString typeNameString = typeName.toString(); + if (const auto type = m_rootScopeImports.value(typeNameString)) { + prop.setType(type); + const QString internalName = type->internalName(); + prop.setTypeName(internalName.isEmpty() ? typeNameString : internalName); + } else { + prop.setTypeName(typeNameString); + } m_currentScope->insertPropertyIdentifier(prop); break; } |