From 3f0f289b28efffa9bf1d0e68e84d01054ecdb3bb Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 8 Apr 2021 09:12:03 +0200 Subject: [PATCH] QmlDesigner: Relaxe value property setter The value.isNull() was misleading. It should only check if a value is invalid. The null sematics in Qt are special anyway because it they can be misleading. Most values have no special "null" value like pointers or NaN with floating point values. QString is for example exposes it's implementation with a pointer. Sometimes zero is reportet as null but this not what we wanted to know. So just treat null strings as empty strings. Change-Id: I6599f6c97f22aff83779a0b32415bf52fd64d82f Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/designercore/model/variantproperty.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp index 498faea6ecb..d2a7dc18709 100644 --- a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp @@ -57,8 +57,7 @@ void VariantProperty::setValue(const QVariant &value) if (isDynamic()) qWarning() << "Calling VariantProperty::setValue on dynamic property."; - // QVector*D(0, 0, 0) detects as null variant though it is valid value - if (value.isNull() && (value.type() != QVariant::Vector3D && value.type() != QVariant::Vector2D)) + if (!value.isValid()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name()); if (internalNode()->hasProperty(name())) { //check if oldValue != value