PDA

View Full Version : How do I control the QTableView row selection color when the control loses focus?



astibich
29th July 2014, 05:17
By default, the QTableView changes the selection color to grey when the control loses focus. I would like to remove this behavior and have the selection color be blue regardless of focus. How do I achieve this?

RameshNani
29th July 2014, 08:31
Have you tried this ?
viewOption.palette.setColor(QPalette::Text, getColor(QColor);
Also use setAlternatingRowColors(true);

wysota
29th July 2014, 15:28
More probably:


QPalette p = palette();
p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight));
setPalette(p);

or similar.

astibich
29th July 2014, 19:18
That worked! Thanks!!