I am having trouble changing the highlight colour of a QCombobox in PyQt. I have managed to change the highlight colour of the actual input box but when the drop down appears it is still blue. The following images shows what is exactly happening. The palette method works on Linux but not on Windows (what I am currently using). I used PyQt palette:
brush = QtGui.QBrush(QtGui.QColor(168, 168, 168))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Highlight, brush)
self.comboBox_7.setPalette(palette)
Here I managed to change the highlight colour to grey of the actual box:
but here the drop down highlight is still blue:
all help appreciated.
According to the Qt docs, the palette may not always work on some platforms:
The Qt Style Sheets Overview suggests that a stylesheet should work where the palette doesn't. I cannot test this myself on anything other than Linux, but the following seems to work okay: