Results 1 to 5 of 5

Thread: QString::number(v, 'g', 3), how to change limits of 'g' for log. values

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QString::number(v, 'g', 3), how to change limits of 'g' for log. values

    Quote Originally Posted by d_stranz View Post
    Well, good. Keep it a secret. After all, the purpose of this forum isn't really to share information, it's to get help for yourself only, right?
    No panic, i had already written it here. Can i check it first if it realy works? Right?


    The only solution i found was to check the value in a func an return it formated.

    Qt Code:
    1. if( v >= 1E-1 )
    2. return QString::number(v, 'G', 3);
    3. else
    4. return QString::number(v, 'e', 0);
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to HappyCoder for this useful post:

    d_stranz (27th July 2015)

Similar Threads

  1. Replies: 7
    Last Post: 3rd April 2014, 12:56
  2. Replies: 4
    Last Post: 13th May 2013, 21:29
  3. Strange QString::number behaviour
    By sastrian in forum Qt Programming
    Replies: 1
    Last Post: 7th September 2012, 08:29
  4. Replies: 4
    Last Post: 1st February 2010, 14:21
  5. strange problem about QString::number(double)
    By yuzr in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 24th December 2007, 13:05

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
  •  
Qt is a trademark of The Qt Company.