View Full Version : QHeaderView: background of selected header item with CSS

6th June 2009, 14:16
Hi CSS Experts !

Is it possible to change the background of the header in a QTableView too with CSS.
For the QTableView it works well. And also the background color of the
QHeaderView (not selected) can be set. But I can't figure out, how the header
background can be changed, if one/more items in the Table are selected.

thanks for your help,

7th June 2009, 09:52
You probably have to dynamically set the style sheet upon detecting changes in the view's selection model.

7th June 2009, 18:56
You are right. The problem seems to be the version 4.3.3 which doesn't support a lot of features for table and tree view. Doing this dynamically seems to be the only chance.
Can't await the migration to 4.5 :-)


7th June 2009, 22:35
I don't think 4.5 will change anything in your situation.

8th June 2009, 01:03
That wouldn't be a desaster. I've just tried the possibilities of CSS in Qt.
I think that :item :indicator is not part of Qt 4.3.3 , but Qt4.5.
I'm not sure if this solves the problem.

best regards,

8th June 2009, 08:37
But you're not using ::item, you want to modify the header which is not an item.