QSS Workaround for a difficult draw topic of QComboBox
If you don't use a QSS block, the QComboBox is drawn with its OS-Look-and-Feel. If you are starting to specify QSS rules some or all subcontrols of the QComboBox begin to lose the OS-Look-and-Feel. In worst case you have to specify all properties in QSS now.
Subject of this article is the choice indicator, drawn by the QStyleViewItem class, a render helper implemented in .../src/gui/widgets/qcombobox_p.h within the QT sources. This functionality seems to be unpossible modifyable by a subclass of QProxyStyle which can be used in other cases for hard layout problems.
However, I found a solution in QSS by specifying a well chosen set of rules:
/* Background color of popup-list.*/
QComboBox QListView{
background-color:white;
border:1px solid gray;
}
/* Needed to complete the rule set. */
QComboBox::item:alternate {
background: white;
}
/* Color of the selected list item. */
QComboBox::item:selected {
border: 1px solid transparent;
background:yellow;
}
/* Indicator will shine through the label text if you don't make it hidden. */
QComboBox::indicator{
background-color:transparent;
selection-background-color:transparent;
color:transparent;
selection-color:transparent;
}