Results 1 to 2 of 2

Thread: Formatting real in QML

  1. #1

    Default Formatting real in QML

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Formatting real in QML

    Can't you use javascript's Math library?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Number formatting
    By squidge in forum Newbie
    Replies: 4
    Last Post: 29th October 2009, 19:16
  2. QString formatting issue.
    By George Neil in forum Qt Programming
    Replies: 2
    Last Post: 22nd October 2009, 10:00
  3. Formatting a QString
    By icentenee in forum Newbie
    Replies: 9
    Last Post: 1st October 2006, 18:41
  4. QString formatting
    By brcain in forum Qt Programming
    Replies: 1
    Last Post: 27th September 2006, 04:00
  5. QToolBox Formatting
    By cwalsh in forum Newbie
    Replies: 8
    Last Post: 10th January 2006, 00:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.