TeaOverflow
TeaOverflow

Reputation: 2578

QTableView - sort headers

Is it possible to sort the headers of a QTableView? enter image description here

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

Answers (1)

Tim Meyer
Tim Meyer

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

Related Questions