Results 1 to 3 of 3

Thread: QStandardItemModel / QTableView sorting issue

Hybrid View

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

    Default Re: QStandardItemModel / QTableView sorting issue

    Or you can try this if you are not too fussy about display format:
    Qt Code:
    1. for(unsigned char i = 0; i < 6; i++)
    2. {
    3. item = new QStandardItem;
    4. // put a QVariant(int) into the DisplayRole rather than a string
    5. item->setData(rpm.at(i), Qt::DisplayRole);
    6. model->setItem(i,0,item);
    7. model->setItem(i,1,new QStandardItem(QString::number(other.at(i))));
    8. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by ChrisW67; 31st August 2010 at 06:57.

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

    AlphaWolfXV (31st August 2010)

Similar Threads

  1. QTableView sorting
    By gabriels in forum Qt Programming
    Replies: 11
    Last Post: 6th October 2010, 17:13
  2. Sorting a QStringlist issue
    By George Neil in forum Qt Programming
    Replies: 4
    Last Post: 30th September 2009, 05:23
  3. qtableview QStandardItemModel read only
    By JeanC in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2008, 16:42
  4. Extract QStandardItemModel from QTableView
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2008, 08:34
  5. Sorting QTableView
    By Jimmy2775 in forum Qt Programming
    Replies: 7
    Last Post: 9th February 2006, 16:47

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