PDA

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



astibich
29th July 2014, 04: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, 07:31
Have you tried this ?
viewOption.palette.setColor(QPalette::Text, getColor(QColor);
Also use setAlternatingRowColors(true);

wysota
29th July 2014, 14: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, 18:18
That worked! Thanks!!