QmlDesigner: Ignore properties without type

Task-number: QDS-6775
Change-Id: I6c280200348058de4d2ee64e5eee3856fa77da50
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
Marco Bubke
2022-04-20 17:09:50 +02:00
parent 258871aa37
commit 056db316f9
2 changed files with 23 additions and 0 deletions

View File

@@ -218,6 +218,9 @@ Storage::PropertyDeclarations createProperties(
propertyDeclarations.reserve(Utils::usize(qmlProperties)); propertyDeclarations.reserve(Utils::usize(qmlProperties));
for (const QQmlJSMetaProperty &qmlProperty : qmlProperties) { for (const QQmlJSMetaProperty &qmlProperty : qmlProperties) {
if (qmlProperty.typeName().isEmpty())
continue;
Utils::SmallString propertyTypeName{ Utils::SmallString propertyTypeName{
fullyQualifiedTypeName(qmlProperty.typeName(), componentNameWithoutNamespace)}; fullyQualifiedTypeName(qmlProperty.typeName(), componentNameWithoutNamespace)};

View File

@@ -304,6 +304,26 @@ TEST_F(QmlTypesParser, PropertiesWithQualifiedTypes)
Storage::PropertyDeclarationTraits::None))))); Storage::PropertyDeclarationTraits::None)))));
} }
TEST_F(QmlTypesParser, PropertiesWithoutType)
{
QString source{R"(import QtQuick.tooling 1.2
Module{
Component { name: "QObject"
Property { name: "objectName"}
Property { name: "target"; type: "QObject"; isPointer: true }
}})"};
parser.parse(source, imports, types, projectData);
ASSERT_THAT(types,
ElementsAre(
Field(&Storage::Type::propertyDeclarations,
UnorderedElementsAre(
IsPropertyDeclaration("target",
Storage::ImportedType{"QObject"},
Storage::PropertyDeclarationTraits::IsPointer)))));
}
TEST_F(QmlTypesParser, Functions) TEST_F(QmlTypesParser, Functions)
{ {
QString source{R"(import QtQuick.tooling 1.2 QString source{R"(import QtQuick.tooling 1.2