QSS workaround for complex theme for QComboBox
If you are not using a QSS block, the QComboBox is drawn using OS-Look-and-Feel. If you start specifying QSS rules, some or all of the QComboBox subcontrollers begin to lose OS-Look-and-Feel. In the worst case, you should specify all the properties in QSS now.
The topic of this article is a selection indicator drawn by the QStyleViewItem class, a visualization assistant implemented in ... / src / gui / widgets / qcombobox _p.h in QT sources. This functionality seems impossible to modify the QProxyStyle subclass, which can be used in other cases for tough layout tasks.
However, I found a solution in QSS by specifying a well-chosen set of rules:
QComboBox QListView{ background-color:white; border:1px solid gray; } QComboBox::item:alternate { background: white; } QComboBox::item:selected { border: 1px solid transparent; background:yellow; } QComboBox::indicator{ background-color:transparent; selection-background-color:transparent; color:transparent; selection-color:transparent; }
source share