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
|
PropertyDeclarationId NodeMetaInfo::defaultPropertyDeclarationId() const
|
||||||
{
|
{
|
||||||
if (!m_defaultPropertyId)
|
if (!m_defaultPropertyId)
|
||||||
m_defaultPropertyId = m_projectStorage->defaultPropertyDeclarationId(m_typeId);
|
m_defaultPropertyId.emplace(m_projectStorage->defaultPropertyDeclarationId(m_typeId));
|
||||||
|
|
||||||
return *m_defaultPropertyId;
|
return *m_defaultPropertyId;
|
||||||
}
|
}
|
||||||
|
@@ -458,7 +458,9 @@ void addType(Storage::Synchronization::Types &types,
|
|||||||
createProperties(component.ownProperties(), enumerationTypes, componentNameWithoutNamespace),
|
createProperties(component.ownProperties(), enumerationTypes, componentNameWithoutNamespace),
|
||||||
std::move(functionsDeclarations),
|
std::move(functionsDeclarations),
|
||||||
std::move(signalDeclarations),
|
std::move(signalDeclarations),
|
||||||
createEnumeration(enumerations));
|
createEnumeration(enumerations),
|
||||||
|
Storage::Synchronization::ChangeLevel::Full,
|
||||||
|
Utils::SmallString{component.ownDefaultPropertyName()});
|
||||||
tracer.end(keyValue("type", type));
|
tracer.end(keyValue("type", type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -838,4 +838,17 @@ TEST_F(QmlTypesParser, uses_no_custom_parser)
|
|||||||
ASSERT_THAT(types, ElementsAre(IsTypeTrait(UsesCustomParser(false))));
|
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
|
} // namespace
|
||||||
|
Reference in New Issue
Block a user