PDA

View Full Version : QTableWidget column based sorting



shadowfax
17th July 2011, 23:35
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 ?

ChrisW67
18th July 2011, 00:01
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?

shadowfax
18th July 2011, 10:00
I mean sorting like in file browser where you can sort data by date,name or size.

prabhudev
21st August 2012, 11:22
if you are using qt creator, in property editor of qtabewidget u ll find sortenable option...else use

void sortItems ( int column, Qt::SortOrder order = Qt::AscendingOrder )