Remove semi-transparent background and border from items in QComboBox / QAbstractItemView
Unsolved
General and Desktop
-
How do I remove this predefined semi-transparent background and border from items in QComboBox / QAbstractItemView? The whole thing is particularly noticeable since I added a little more space (padding) on the left and right. I've already tried overriding all properties; but only found out that I can change the color with "selection-background-color", but not remove the transparency.
Ultimately, I just want a flat design.
For easier understanding, here is the code (inside a Python format string):
QComboBox {{ background-color: #FFF; border: none; color:#3C3C3C; font-size: {design.font_size}; height: {design.width}px; padding: 0 {design.padding}px; }} QComboBox:editable {{ background: #FFF; }} QComboBox QAbstractItemView {{ border: 1px solid {ac}; font-size: {design.notepad_font_size}; }} QComboBox QAbstractItemView::item {{ border: none; color: #3C3C3C; height: {design.width}px; padding: 0 {design.padding}px; selection-background-color: #F29100; }} QComboBox QAbstractItemView::item:hover, QComboBox QAbstractItemView::item:selected {{ background-color: #F29100; border: none; selection-color: #FFF; }}
-
I have the same problem with the QListWidget, but I was able to switch off this annoying background by specifying
setFocusPolicy(Qt.NoFocus)
. Unfortunately, this doesn't work with my drop-down list:def DropDownList(*items: str) -> QComboBox: list = QDropDownList(*items) list.setFocusPolicy(Qt.NoFocus) view = list.view() view.setEditTriggers(QAbstractItemView.NoEditTriggers) view.setFocusPolicy(Qt.NoFocus) return list