[Qt-qml] Assingments of reals to ints round rather than truncate - why?

alistair.adams at nokia.com alistair.adams at nokia.com
Sat Nov 5 05:54:47 CET 2011


property int foo=696/10 evaluates to 70, not 69 as I expected.

QML appears to do a round rather than a truncate when assigning a real expression to an int. Easy to fix by subtracting 0.5 but more to the point, is this intended behavior? I could not find anything in the documentation that describes how it should behave.

Interestingly "property int foo=69.6" fails but "property int foo=696/10.0" doesn't.

-Alistair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111105/aec439a3/attachment.html 


More information about the Qt-qml mailing list