Reputation: 2578
Is it possible to sort the headers of a QTableView?
I'd like to sort the horizontal and vertical headers. QTableView only offers functionality to sort a column's contents. Is there a way to sort the view or do I have to sort the underlying datastructures?
Upvotes: 4
Views: 1641
Reputation: 12600
Afaik there is no pre-implemented way to do that.
One way would be to subclass QSortFilterProxyModel, sort the rows by whatever you use in order to fill the vertical header and then manually sort the columns using QHeaderView::moveSection().
Upvotes: 2