diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-10-27 11:47:05 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-12-15 14:03:55 +0100 |
commit | dfdba3b12bc10a3e1da8cde99a8697969ac165ef (patch) | |
tree | e653dbb43f77a8ff156047acdcefcc49708e294b /src/qml/qml/qqmlbinding_p.h | |
parent | 7d5cc737db18b321f224eef168639382d3f1f4b9 (diff) |
QQuickStates: Handle more types as result of when
When calling QQmlBinding::evaluate(), we get a generic QVariant back,
and no conversions from the evaluation result to bool are done at that
point. Consequently, we would need to mirror the engines conversion from
arbitrary values to bool.
Doing that manually is rather fragile, so we instead use the QMetaType
based overload, which already takes care of the conversion. That
requires making the overload public.
As qmlsc is already using that overload from within evaluate, it was not
affected by the bug.
Fixes: QTBUG-108024
Pick-to: 6.2 6.4 6.5
Change-Id: I3d5ee8f886ea6ada44fc8182300f3472cb1efc3c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlbinding_p.h')
-rw-r--r-- | src/qml/qml/qqmlbinding_p.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h index 08e61a7aef..00aa0d6f58 100644 --- a/src/qml/qml/qqmlbinding_p.h +++ b/src/qml/qml/qqmlbinding_p.h @@ -79,6 +79,10 @@ public: }; QVariant evaluate(); + bool evaluate(void *result, QMetaType type) + { + return QQmlJavaScriptExpression::evaluate(&result, &type, 0); + } void expressionChanged() override; @@ -116,10 +120,6 @@ protected: QQmlPropertyData::WriteFlags flags); QV4::ReturnedValue evaluate(bool *isUndefined); - bool evaluate(void *result, QMetaType type) - { - return QQmlJavaScriptExpression::evaluate(&result, &type, 0); - } private: static QQmlBinding *newBinding(const QQmlPropertyData *property); |