PDA

View Full Version : change color of inactive selections (qtablewidget)



tuli
23rd August 2014, 18:19
One can change nicely the backgroundcolor of selected items in QTableWidget by setting a custom palette:



QPalette palette;
palette.setColor(QPalette::Highlight, Qt::cyan);
setPalette(palette);


However, i have 2 QTableWidgets next to each other. Both have some items selected. If i focus in on one, the selected items color changes (active selected: darkBlue, inactive selected: grey). The same thing happens when i set a custom color with the above code.


How can i change the colors so that they are the same for active and inactive selections?



p.s. While we are at it, is there any more specific way to change the selection background color of items, besides CSS and custom delegates?