forked from qt-creator/qt-creator
QmlDesigner: Extract default property in qml document parser
Change-Id: I2b3576312cc2bec0c2e103fd3f342a5fe059b10c Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -353,7 +353,7 @@ Storage::Synchronization::Type QmlDocumentParser::parse(const QString &sourceCon
|
|||||||
m_storage);
|
m_storage);
|
||||||
|
|
||||||
type.prototype = createImportedTypeName(qmlObject.name(), qualifiedImports);
|
type.prototype = createImportedTypeName(qmlObject.name(), qualifiedImports);
|
||||||
|
type.defaultPropertyName = qmlObject.localDefaultPropertyName();
|
||||||
addImports(imports, qmlFile->imports(), sourceId, directoryPath, m_storage);
|
addImports(imports, qmlFile->imports(), sourceId, directoryPath, m_storage);
|
||||||
|
|
||||||
addPropertyDeclarations(type, qmlObject, qualifiedImports, file);
|
addPropertyDeclarations(type, qmlObject, qualifiedImports, file);
|
||||||
|
@@ -516,4 +516,16 @@ TEST_F(QmlDocumentParser, qualified_list_property)
|
|||||||
Storage::PropertyDeclarationTraits::IsList)));
|
Storage::PropertyDeclarationTraits::IsList)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(QmlDocumentParser, default_property)
|
||||||
|
{
|
||||||
|
auto type = parser.parse(R"(import Example 2.1 as Example
|
||||||
|
Item{
|
||||||
|
default property list<Example.Foo> foos
|
||||||
|
})",
|
||||||
|
imports,
|
||||||
|
qmlFileSourceId,
|
||||||
|
directoryPath);
|
||||||
|
|
||||||
|
ASSERT_THAT(type.defaultPropertyName, Eq("foos"));
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Reference in New Issue
Block a user