Results 1 to 4 of 4

Thread: numeric value problem...

  1. #1

    Default numeric value problem...

    Hi,

    I have qlineedit field "le03" and i need to show the result of :

    QString::number(le01->text().toDouble() / 2) where le01 = "99999999.00"
    in that field.

    The problem is the operation shows a scientific notation value. I need to show the result like this: 49999999.05

    Thanks

  2. #2
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: numeric value problem...

    Try this: QString::number(le01->text().toDouble() / 2, 'f')

    And try to look it up in the Qt docs next time.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  3. #3

    Default Re: numeric value problem...

    Thanks for your help and your time!!!

    PD/ About qt docs, i did it and i didn't find the answer..... that's is the post reason!!

  4. #4
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: numeric value problem...

    Then look closer
    QString QString::number ( double n, char format = 'g', int precision = 6 ) [static]

    This is an overloaded member function, provided for convenience.
    Returns a string equivalent of the number n, formatted according to the specified format and precision. The format can be 'f', 'F', 'e', 'E', 'g' or 'G' (see the arg() function documentation for an explanation of the formats).
    Unlike QLocale::toString(), this function does not honor the user's locale settings.
    See also setNum() and QLocale::toString().
    We can't solve problems by using the same kind of thinking we used when we created them

Similar Threads

  1. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 09:52
  2. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.