How to get some value which specifies which column the data is sorted by (and whether it’s ascending or descending) in QTableWidget? I couldn’t find anything in the documentation about it, only about sorting programmatically.
How to get some value which specifies which column the data is sorted by
Share
You can access that through the table header. Basically in Qt everything that is related to whole columns is accesses through the horizontal header of the table, and everything related to whole rows is accessed though the vertical headers. This includes default sizes, stretches, or, in your case, the sort properties.
SortIndicatorOrder()function returns the sort order asQt::SortOrderenum wihch can be eitherQt::AscendingOrdera.k.a.0, orQt::DescendingOrdera.k.a.1. You can use it ilke this:sortIndicatorSection()function returns the column by wihch data is sorted. Column numbers start with 0. You can call it like this: