One can change nicely the backgroundcolor of selected items in QTableWidget by setting a custom palette:


Qt Code:
  1. QPalette palette;
  2. palette.setColor(QPalette::Highlight, Qt::cyan);
  3. setPalette(palette);
To copy to clipboard, switch view to plain text mode 


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?