diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-05 13:20:24 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-05 21:13:00 +0100 |
commit | 4ffa7d3f651757b7bc10ae9801b7802a8f2e260f (patch) | |
tree | 973b50f41d00719c179b9a332feca11dc0c0f32c /src/qml/jsruntime/qv4qobjectwrapper.cpp | |
parent | b63e2e270f79d76d5624e73eb6d05b1bbb55968f (diff) |
Fix rounding behavior of Qml when assigning doubles to integer properties
The engine used to round, but that is inconsistent with ECMAScript's way of
converting doubles to integers by truncation.
With this patch we can also enable the propagation of integer type information
into the IR, but we have to be careful not to utilize it when writing
properties.
Change-Id: I04af4879ba5131349eca2eeff2b27f4598f5267b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 07a4ff7cd7..d5aa9f4ead 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -524,7 +524,7 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro } else if (value->asFunctionObject()) { // this is handled by the binding creation above } else if (property->propType == QMetaType::Int && value->isNumber()) { - PROPERTY_STORE(int, qRound(value->asDouble())); + PROPERTY_STORE(int, value->asDouble()); } else if (property->propType == QMetaType::QReal && value->isNumber()) { PROPERTY_STORE(qreal, qreal(value->asDouble())); } else if (property->propType == QMetaType::Float && value->isNumber()) { |