Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: Number formats 00.00

  1. #21
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Number formats 00.00

    I want to know which solution is accepted by maverick_pol...

  2. #22
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Number formats 00.00

    Quote Originally Posted by rajesh View Post
    ToddAtWSU,
    do you mean this:

    double time = 1.3333;
    QString str = QString("%04.2f").arg(time );

    in this case str storing 1.3333.2f as I checked in Qt4.3.1

    or
    str = QString("%04.2f").arg(time); also not giving correct result

    so, what is the syntax?
    Sorry I meant

    Qt Code:
    1. char str[16];
    2. sprintf( str, "%04.2f", number ); // I believe this is correct using sprintf
    3. QString str = QString(str);
    To copy to clipboard, switch view to plain text mode 

    But I see you got the answer.

Similar Threads

  1. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:34
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

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.