forked from qt-creator/qt-creator
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:
@@ -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)};
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user