PDA

View Full Version : Disable sorting for a column on QTableView



chapu
28th March 2012, 22:18
I am using QTableView with a QSortFilterProxyModel(). By default, all columns on QTableView is sortable by clicking individual column header. But for my application, I do not want the users to sort the rows by column 0. Or put it this way, no sorting when the header of column 0 is clicked. Is there any way to do this?

Thanks a lot,
PX

wysota
28th March 2012, 23:02
Subclass the proxy model and reimplement sort() so that there is no sorting for the column you want.

chapu
29th March 2012, 18:38
Thanks a lot. It works very well.