QmlDesigner: qml document parser traits

A file component is always of the reference kind. Sets the file
component trait too.

Task-number: QDS-12665
Change-Id: I800b32a4d204fb016c1274d05c08695b01581ae4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2024-07-30 17:20:52 +02:00
parent 7ead23ae0e
commit e3a062837d
7 changed files with 66 additions and 26 deletions

View File

@@ -2624,6 +2624,9 @@ void ProjectStorage::synchronizeTypeAnnotations(Storage::Synchronization::TypeAn
void ProjectStorage::synchronizeTypeTrait(const Storage::Synchronization::Type &type)
{
if (type.changeLevel == Storage::Synchronization::ChangeLevel::Minimal)
return;
s->updateTypeTraitStatement.write(type.typeId, type.traits.type);
}

View File

@@ -1113,7 +1113,6 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
package.updatedSourceIds.push_back(sourceId);
type.typeName = SourcePath{qmlFilePath}.name();
type.traits = Storage::TypeTraitsKind::Reference;
type.sourceId = sourceId;
type.exportedTypes = std::move(exportedTypes);

View File

@@ -297,6 +297,15 @@ void addEnumeraton(Storage::Synchronization::Type &type, const QmlDom::Component
}
}
Storage::TypeTraits createTypeTraits()
{
Storage::TypeTraits traits = Storage::TypeTraitsKind::Reference;
traits.isFileComponent = true;
return traits;
}
} // namespace
Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceContent,
@@ -363,6 +372,7 @@ Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceCon
directoryPath,
m_storage);
type.traits = createTypeTraits();
type.prototype = createImportedTypeName(qmlObject.name(), qualifiedImports);
type.defaultPropertyName = qmlObject.localDefaultPropertyName();
addImports(imports, qmlFile->imports(), sourceId, directoryPath, m_storage);