View Full Version : Qtablewidget and selection color

17th January 2013, 11:47
Hy all,
i'm developing using old QT 4.2 and i've this question.
I have a table ( Qtablewidget) and only some cells of a single row, have a different background color (red in my table), the other have the default background color.

When i select the row i notice that the selected color override the cells color, but i need that the cells with different background (red in my table )remains with the old colour.

Is there a way to do this ?

Thanks in advance

17th January 2013, 23:40
You have to use QStyledItemDelegate subclass and reimplement paint() function to establish a new behavior for QStyle::State_Selected option. Look at StarDelegate example closely.

18th January 2013, 10:38
I see but this example use QTableView...unifortunatly i've to use QTablewidget....
Is there any example with Qtablewidget ?