[Qt-qml] Formatting text output
Pelle Johnsen
pelle.johnsen at gmail.com
Sat May 7 21:57:37 CEST 2011
You should be able to use standard JavaScript toFixed method, eg.
Text {
text: Number(slider.value).toFixed(2)
}
-Pelle
On Sat, May 7, 2011 at 8:31 PM, Ganshorn Thomas <mailings at novaimages.de>wrote:
> Hi
>
> i tried to test some stuff in qml to see if it is suitable for my project.
> So i tried to do my own slider.
> Although this is working, i want to see the current value of the slider as
> a text.
> Therefore i created a text element and set the text property by
>
> Text
> {
> ....
> text: slider.value
> }
>
> altough i see the value, it is unusable because i have eg. a number of
> 2.12345678
> how can i clip the text ? is there a formatter class or something like that
> ?
>
> Greetings
> Thomas
>
>
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110507/75fc1047/attachment.html
More information about the Qt-qml
mailing list