Results 1 to 5 of 5

Thread: representation of numbers in QTableView...

  1. #1
    Join Date
    Jan 2012
    Location
    Argentina
    Posts
    167
    Thanks
    33
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default representation of numbers in QTableView...

    hi all, the moment the numbers i have pass the millon barrier the QtableView converts them into, for example, 100023e+12....

    how can i change that? i want to see them plain numbers and i dont want to change the model column type to QString...


    thank u all in advance

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: representation of numbers in QTableView...

    QStyledItemDelegate specifically QStyledItemDelegate::displayText() and QString::number() if it is just the display (not the editor) you wish to affect.

  3. #3
    Join Date
    Jan 2012
    Location
    Argentina
    Posts
    167
    Thanks
    33
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: representation of numbers in QTableView...

    Are you saying i should reimplement some methods of the class QStyledItemDelegate??? can you show me a little example cause im trying this...

    Qt Code:
    1. QStyledItemDelegate *display = new QStyledItemDelegate ();
    2. this->ui->data_table->setItemDelegateForColumn (5, display);
    To copy to clipboard, switch view to plain text mode 

    with no luck...i ll keep searching

    thanks a lot!

  4. #4
    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: representation of numbers in QTableView...

    Yes, you should subclass QStyledItemDelegate and reimplement displayText()
    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.


  5. The following user says thank you to wysota for this useful post:

    KillGabio (26th January 2012)

  6. #5
    Join Date
    Jan 2012
    Location
    Argentina
    Posts
    167
    Thanks
    33
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: representation of numbers in QTableView...

    will do, thank both

Similar Threads

  1. true representation in binary or hex
    By Tadas in forum Newbie
    Replies: 12
    Last Post: 10th October 2010, 19:02
  2. Graphical representation of an array
    By ithinkso in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2010, 23:30
  3. QTableView + sorting + numbers & special characters
    By foggy-mind in forum Qt Programming
    Replies: 5
    Last Post: 4th June 2009, 11:11
  4. Tree related representation
    By aegis in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2007, 12:20
  5. Replies: 1
    Last Post: 2nd April 2007, 22:52

Tags for this Thread

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.