forked from qt-creator/qt-creator
QmlDesigner: Extract default property in qmltypes parser
Change-Id: I0cc9ac71ba764db252e302d11d1cd3e4aff834f5 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -2092,7 +2092,7 @@ const Storage::Info::Type &NodeMetaInfo::typeData() const
|
||||
PropertyDeclarationId NodeMetaInfo::defaultPropertyDeclarationId() const
|
||||
{
|
||||
if (!m_defaultPropertyId)
|
||||
m_defaultPropertyId = m_projectStorage->defaultPropertyDeclarationId(m_typeId);
|
||||
m_defaultPropertyId.emplace(m_projectStorage->defaultPropertyDeclarationId(m_typeId));
|
||||
|
||||
return *m_defaultPropertyId;
|
||||
}
|
||||
|
@@ -458,7 +458,9 @@ void addType(Storage::Synchronization::Types &types,
|
||||
createProperties(component.ownProperties(), enumerationTypes, componentNameWithoutNamespace),
|
||||
std::move(functionsDeclarations),
|
||||
std::move(signalDeclarations),
|
||||
createEnumeration(enumerations));
|
||||
createEnumeration(enumerations),
|
||||
Storage::Synchronization::ChangeLevel::Full,
|
||||
Utils::SmallString{component.ownDefaultPropertyName()});
|
||||
tracer.end(keyValue("type", type));
|
||||
}
|
||||
|
||||
|
@@ -838,4 +838,17 @@ TEST_F(QmlTypesParser, uses_no_custom_parser)
|
||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(UsesCustomParser(false))));
|
||||
}
|
||||
|
||||
TEST_F(QmlTypesParser, default_property)
|
||||
{
|
||||
QString source{R"(import QtQuick.tooling 1.2
|
||||
Module{
|
||||
Component { name: "QObject"
|
||||
defaultProperty: "children" }})"};
|
||||
|
||||
parser.parse(source, imports, types, projectData);
|
||||
|
||||
ASSERT_THAT(types,
|
||||
ElementsAre(Field(&Synchronization::Type::defaultPropertyName, Eq("children"))));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user