Results 1 to 4 of 4

Thread: QTableWidget column based sorting

  1. #1
    Join Date
    Jun 2009
    Posts
    21
    Qt products
    Platforms
    Unix/X11 Windows

    Default QTableWidget column based sorting

    Hi,

    Is it possible to sort data in QTableWidget based on column header ? I tried to change __lt__ method of QTableWidget class (I'm using PyQt) ,but It doesn't allow to customize sorting for each column header. Is it possible to do this using item based widget ?

  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: QTableWidget column based sorting

    Do you mean reorder the columns based on the text in the horizontal header view cells or to sort the rows based on multiple columns?

  3. #3
    Join Date
    Jun 2009
    Posts
    21
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget column based sorting

    I mean sorting like in file browser where you can sort data by date,name or size.

  4. #4
    Join Date
    May 2012
    Posts
    33
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget column based sorting

    if you are using qt creator, in property editor of qtabewidget u ll find sortenable option...else use
    Qt Code:
    1. void sortItems ( int column, Qt::SortOrder order = Qt::AscendingOrder )
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Dynamic sorting using proper column after adding a row.
    By kremuwa in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2010, 23:50
  2. Replies: 0
    Last Post: 5th November 2008, 14:31
  3. Sorting column in QTreeWidget
    By lni in forum Qt Programming
    Replies: 8
    Last Post: 14th November 2007, 18:35
  4. Column Sorting
    By sumsin in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 07:48
  5. Sorting Tree items based on database properties
    By jnk5y in forum Qt Programming
    Replies: 3
    Last Post: 13th April 2006, 19:44

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.