Results 1 to 2 of 2

Thread: QTable Sorting

  1. #1
    Join Date
    Apr 2009
    Posts
    1
    Qt products
    Platforms
    MacOS X Unix/X11 Windows

    Default QTable Sorting

    So I am building a custom application to manage a stack of items. I have reserved the first row of the table for totaling the values of all the proceeding data in the other rows and columns. Up until this point I haven't needed to turn on the enable sorting option for QTable.

    Was hoping somebody could offer some UI suggestions to help me force a specified row to always be at the top of the row list after changing the sort order. I though I might find some signal associated with the sorting order being changed but really didn't find much.

    Was even thinking of possibly doubling the size of the header then drawing a another table on top of half of the header that looks like one row, Then filling it with the necessary data to look like a totaling bar. The big issue with this is that the sorting icon would be hidden.

    Another option would be to have one Qtable with a header and totaling bar control the sorting of another QTable that conatins the data.

    Not sure if any of these solutions are feasible or worthwhile. Any suggestion would be a great help.

    -Romey

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTable Sorting

    Hi, just a quick guess if you use QTableWidget. Subclass and:
    Qt Code:
    1. void MyTableView::sortByColumn ( int column, Qt::SortOrder order )
    2. {
    3. QTableView::sortByColumn ( column, order );
    4. // here set your fix line back to top.
    5. }
    To copy to clipboard, switch view to plain text mode 

    Do the same for QTableWidget::sortItems().

Similar Threads

  1. QTable - paintCell() - how to do with it?
    By mp33919 in forum Qt Programming
    Replies: 8
    Last Post: 23rd April 2009, 19:55
  2. Qt4: Sorting QAbstractItemVew inherited view
    By nando in forum Qt Programming
    Replies: 3
    Last Post: 12th February 2008, 18:30
  3. Column Sorting
    By sumsin in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 07:48
  4. [QT4] QTreeView, QAbstractItemModel and sorting
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2006, 20:16
  5. QTable..Vs.. QListView
    By :db:sStrong in forum Qt Programming
    Replies: 1
    Last Post: 15th February 2006, 21:03

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.