PDA

View Full Version : Formatting real in QML



petermcg
25th November 2010, 02:59
Hello all,

I'd like to know if there is a way to format the precision of the 'real' type in QML? At the moment I am displaying a double value exposed from a C++ class and the displayed precision is too high. I'd like to display only two decimal places. I know I can do this in Qt by creating a string using setNum, but I'd prefer to just expose the double value and do my formatting from within the QML file. Any ideas?

Cheers,

Peter

wysota
27th November 2010, 00:24
Can't you use javascript's Math library?