diff options
author | Teemu Holappa <teemu.holappa@qt.io> | 2019-10-11 14:30:00 +0300 |
---|---|---|
committer | Teemu Holappa <teemu.holappa@qt.io> | 2019-10-11 17:26:43 +0300 |
commit | 76da530aca3876cc083988b883658673168821a4 (patch) | |
tree | ca00d6c689f8172bdb8bce304c2985af35f9463f /src | |
parent | 45f95e74297ab3778965319c175a6d726f9c8afe (diff) |
Fix float value binding to an integer
Also NaN values are casted to an integer which causes illegal
integer values.
Task-number: QTBUG-72442
Change-Id: I3ff3c8e4dc493600360448ea30d949c0017da8c3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlbinding.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 3a437eab8d..52572be2b2 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -298,8 +298,9 @@ protected: case QMetaType::Int: if (result.isInteger()) return doStore<int>(result.integerValue(), pd, flags); - else if (result.isNumber()) - return doStore<int>(result.doubleValue(), pd, flags); + else if (result.isNumber()) { + return doStore<int>(QV4::StaticValue::toInteger(result.doubleValue()), pd, flags); + } break; case QMetaType::Double: if (result.isNumber()) |