QTableView sort by ALL Column,not by single Column
-
I want My QTableView sort by ALL Column,not by single Column,How can I do this?
for example:before sort
@1 | 2 | 3
4 | 5 | 6
7 | 8 |
@After sort:
@8 | 7 | 6
5 | 4 | 3
2 | 1 |
@ -
OK,It seems that Qt do not surpport sort by multiple columns default.
But can subclass QSortFilterProxy and impliments yourself.refer:
"Is it possible to sort on multiple columns in QTableView using QSortFilterProxyModel":http://qt-project.org/forums/viewthread/1349
"QSortFilterProxyModel sort multiple columns":http://stackoverflow.com/questions/10893843/qsortfilterproxymodel-sort-multiple-columns
"MultisortTableView":https://github.com/dimkanovikov/MultisortTableView
-
That is not a table then, but a simple list. How about implementing it as an alternate implementation of a list view?
-
listview is not for my application,
I use some tableview features,such as:
setColumnWidth
setRowHeight
setGridStyle
and itemDelegate and customlize tablemodelAnd I found the link above is sort multiple columns but not multiple columns as one list
and subclass QSortFilterProxy to achive is very difficulty for such sort policyso at last, I manage to sort my Model Data myself,and reset the tableview.