QTableView QHeaderView Sorted Column Style.
Unsolved
General and Desktop
-
Hello,
I would like to change text color in header if column is sorted. I try to use style:
QHeaderView::section:checked{color: red;}
QTableView settings:
table->setSortingEnabled(true);
Exists any easy way ho to set this text color via stylesheet?
Thanks, David.
-
@David.Reznicek
I think this is not possible using stylesheets.But you should be able to achieve what you want in your model.
By reimplementing headerData() and for the Qt::ForegroundRole return your desired QColor if the section is sorted. Otherwise return the result from the base class implementation. -
This post is deleted!
-
@raven-worx Thanks a alot....it works. Better than my workaround to override paintSection in QHeaderView.