aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlproperty.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-09-08 14:06:22 +0200
committerLars Knoll <lars.knoll@digia.com>2014-09-11 09:56:48 +0200
commit91d6a63ab317817990c3b2306860adbd8916cca4 (patch)
tree44962e20ce14c594d1f77c7ac4d54d53bd1b158e /src/qml/qml/qqmlproperty.cpp
parent8fab54a5495226b8c06d7708357a23e83444abc0 (diff)
Fix roundtrip conversion between JS var and QVariant
Always convert null to a QVariant(VoidStar) as documented in QJSValue. Make sure the reverse conversion will lead back to a null JS value. Adjusted two test cases that expected an invalid QVariant when setting the property to null, and added test cases for the correct conversion. Task-number: QTBUG-40880 Change-Id: I6eb01f0067f2c89779c53fd2cd0a1193047ed2cc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r--src/qml/qml/qqmlproperty.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 42bf0dd657..09b735ae9e 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1585,11 +1585,14 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
propertyType = propertyMetaObject.className();
}
} else if (value.userType() != QVariant::Invalid) {
- valueType = QMetaType::typeName(value.userType());
+ if (value.userType() == QMetaType::VoidStar)
+ valueType = "null";
+ else
+ valueType = QMetaType::typeName(value.userType());
}
if (!valueType)
- valueType = "null";
+ valueType = "undefined";
if (!propertyType)
propertyType = QMetaType::typeName(type);
if (!propertyType)