diff options
author | Aleksei German <aleksei.german@qt.io> | 2023-11-24 18:11:50 +0100 |
---|---|---|
committer | Aleksei German <aleksei.german@qt.io> | 2024-01-22 09:19:28 +0000 |
commit | ef2f76b2d8e6510a79f3e6a44ff69567fcf3f56e (patch) | |
tree | d399c2611401259c1b4a7591b72af0e2076eaec6 | |
parent | 8238764dcd22bf679d243ec05aaeddac62a9fdc4 (diff) |
QmlDesigner: Equate type var to type variant
Task-number: QDS-11395
Change-Id: Id81ad38f0fa07ce783c93ece70a856ab65cfcbbf
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
4 files changed, 12 insertions, 5 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml index b3353f2fba..39176ca82a 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml @@ -516,6 +516,8 @@ Section { return aliasEditor if (propertyType == "variant") return readonlyEditor + if (propertyType == "var") + return readonlyEditor if (propertyType == "TextureInput") return textureInputEditor if (propertyType == "vector2d" || propertyType == "vector3d" || propertyType == "vector4d") diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectioneditorutils.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectioneditorutils.cpp index c8f16cb350..57ca619a70 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectioneditorutils.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectioneditorutils.cpp @@ -75,7 +75,7 @@ NodeMetaInfo dynamicTypeNameToNodeMetaInfo(const TypeName &typeName, Model *mode return model->metaInfo("QML.string"); else if (typeName == "url") return model->metaInfo("QML.url"); - else if (typeName == "variant") + else if (typeName == "var" || typeName == "variant") return model->metaInfo("QML.variant"); else qWarning() << __FUNCTION__ << " type " << typeName << "not found"; @@ -212,7 +212,7 @@ bool isDynamicVariantPropertyType(const TypeName &type) { // "variant" is considered value type as it is initialized as one. // This may need to change if we provide any kind of proper editor for it. - static const QSet<TypeName> valueTypes{"int", "real", "color", "string", "bool", "url", "variant"}; + static const QSet<TypeName> valueTypes{"int", "real", "color", "string", "bool", "url", "var", "variant"}; return valueTypes.contains(type); } @@ -231,7 +231,7 @@ QVariant defaultValueForType(const TypeName &type) value = false; else if (type == "url") value = ""; - else if (type == "variant") + else if (type == "var" || type == "variant") value = ""; return value; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 3fb5de210c..c695f488b1 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -3108,7 +3108,12 @@ bool NodeMetaInfo::isVariant() const using namespace Storage::Info; return isValid() && isTypeId(m_typeId, m_projectStorage->builtinTypeId<QVariant>()); } else { - return isValid() && simplifiedTypeName() == "QVariant"; + if (!isValid()) + return false; + + const auto type = simplifiedTypeName(); + + return type == "QVariant" || type == "var" || type == "variant"; } } diff --git a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp index 7c57e8ac35..141548047e 100644 --- a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp @@ -311,7 +311,7 @@ QVariant BindingProperty::convertToLiteral(const TypeName &typeName, const QStri qreal realValue = testExpression.toDouble(&ok); if (ok) return realValue; - } else if ("QVariant" == typeName || "variant" == typeName) { + } else if ("QVariant" == typeName || "variant" == typeName || "var" == typeName) { bool ok; qreal realValue = testExpression.toDouble(&ok); if (ok) { |