aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmlbind.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-10-22 08:14:28 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-10-22 20:48:33 +0200
commit51694e7b5b8feb466e3760ca46bd29c14de7590e (patch)
tree193597ff0939b04685e2467e627a121565e09ee2 /src/qml/types/qqmlbind.cpp
parentee469d528a350f1fbcebc12a3728f7ed6f4a1302 (diff)
Make QQmlBind::value a QVariant again
This partially reverts commit 00f903f3b4cd46ddf8361876401e5405030f97f1. We don't need the QJSValue to protect against magic conversions anymore since magic conversions have been removed in commit 1b7a098803a43355abf62e099267d4a122645e07. Change-Id: I3e60d8562d409144cdb921060c2736b1f8278e2b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/qml/types/qqmlbind.cpp')
-rw-r--r--src/qml/types/qqmlbind.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index 5c5bbefb43..b8adcb1d2f 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -82,7 +82,12 @@ public:
QQmlNullableValue<bool> when;
QPointer<QObject> obj;
QString propName;
- QQmlNullableValue<QJSValue> value;
+
+ // An invalid QVariant has special semantics that you may explicitly want when writing the
+ // value. Therefore we need to denote "is not set" in a different way. We do this by wrapping
+ // the value in QQmlNullableValue.
+ QQmlNullableValue<QVariant> value;
+
QQmlProperty prop;
QQmlAnyBinding prevBind;
QV4::PersistentValue v4Value;
@@ -296,13 +301,13 @@ void QQmlBind::setProperty(const QString &p)
The value to be set on the target object and property. This can be a
constant (which isn't very useful), or a bound expression.
*/
-QJSValue QQmlBind::value() const
+QVariant QQmlBind::value() const
{
Q_D(const QQmlBind);
return d->value.value;
}
-void QQmlBind::setValue(const QJSValue &v)
+void QQmlBind::setValue(const QVariant &v)
{
Q_D(QQmlBind);
d->value = v;
@@ -512,7 +517,7 @@ void QQmlBind::eval()
}
d->writingProperty = true;
- d->prop.write(d->value.value.toVariant());
+ d->prop.write(d->value.value);
d->writingProperty = false;
}