Results 1 to 15 of 15

Thread: The precision range of double

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: The precision range of double

    Quote Originally Posted by nikhilqt View Post
    I just looked into the signature and the parameters of the method, as such it returns me the string only. Again if i click on the column header of the tableview it gives me string compare only. correct me if Iam wrong.
    So you didn't implement anything, just assumed it wouldn't work anyway?
    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.


  2. #2
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    8
    Thanked 7 Times in 7 Posts

    Default Re: The precision range of double

    Quote Originally Posted by wysota View Post
    So you didn't implement anything, just assumed it wouldn't work anyway?
    I would rather put it this way, I started with the process and did not get how to change the precision.

    QStyledItemDelegate::displaytext(...) takes QVariant and the QLocale.

    After setting up this delegate to my model, this displaytext is called for showing the text on the view. But here i stuck up, as how to draw all the decimals.

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

    Default Re: The precision range of double

    Hmm... I even told you which method to use to get the desired output... I really don't understand what is so hard there to understand...

    Qt Code:
    1. QString myDelegate::displayText(const QVariant &val, const QLocale &locale) const {
    2. if(val.type()==QVariant::Double) return locale.toString(val.toDouble(), 'g', 12); // or QString::number(val.toDouble(), 'g', 12)
    3. return QStyledItemDelegate::displayText(val, locale);
    4. }
    To copy to clipboard, switch view to plain text mode 
    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. Double Click Capturing
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2011, 15:12
  2. Spectrogram Plot Hints
    By shargath in forum Qwt
    Replies: 2
    Last Post: 25th February 2009, 12:11
  3. Replies: 1
    Last Post: 24th July 2008, 19:20
  4. Scaling
    By AD in forum Qt Programming
    Replies: 16
    Last Post: 11th July 2008, 11:55
  5. Double Buffering for plot graphs
    By Tavit in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 14:10

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.