QmlDesigner: Take '.' properties into account in convertToVariant

What we call dot properties have two styles.

something.x

something {
 x: ...
}

In the second case the prefix is set, because in the model we always
normalize the syntax to the first case.

toString() properly walks the array to collect the full identifier, instead of just taking the base property name.

Before we were using e.g. 'eulerRotation' as the property type and tried to convert a single float to a vector3D. The new code uses thefull property name 'eulerRoation.x' and the conversion succeeds.

Task-number: QDS-10027
Change-Id: I7210558db6a0f91f5f1a25b719df06beb70c5b83
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Thomas Hartmann
2023-06-05 14:30:16 +02:00
parent 616c53d0e6
commit cc67fe2897

View File

@@ -609,8 +609,10 @@ public:
const QString &propertyPrefix, const QString &propertyPrefix,
AST::UiQualifiedId *propertyId) AST::UiQualifiedId *propertyId)
{ {
const QString propertyName = propertyPrefix.isEmpty() ? propertyId->name.toString() const QString propertyName = propertyPrefix.isEmpty()
: propertyPrefix; ? toString(propertyId)
: propertyPrefix + "." + toString(propertyId);
const PropertyMetaInfo propertyMetaInfo = node.metaInfo().property(propertyName.toUtf8()); const PropertyMetaInfo propertyMetaInfo = node.metaInfo().property(propertyName.toUtf8());
const bool hasQuotes = astValue.trimmed().left(1) == QStringLiteral("\"") const bool hasQuotes = astValue.trimmed().left(1) == QStringLiteral("\"")