Define styling for QComboBox and QLineEdit globally

This commit is contained in:
Matthias Metelka 2022-08-16 22:35:34 +02:00
parent dfe06c0643
commit bcf8992a9d
2 changed files with 30 additions and 1 deletions

View file

@ -33,6 +33,9 @@ copy_mdi_icons(
# tags
"tag-outline.svg",
"tag-off-outline.svg",
# QComboBox arrow
"chevron-down.svg",
],
)

View file

@ -186,7 +186,33 @@ class ThemeManager:
gui_hooks.theme_did_change()
def _apply_style(self, app: QApplication) -> None:
buf = ""
buf = f"""
QComboBox,
QLineEdit {{
border: 1px solid {self.color(colors.BORDER)};
border-radius: 5px;
padding: 2px;
}}
QComboBox:focus,
QLineEdit:focus {{
border: 1px solid {self.color(colors.FOCUS_BORDER)};
}}
QComboBox:on {{
border-bottom: none;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}}
QComboBox::drop-down {{
border: 0px; /* This resets the arrow styles */
subcontrol-origin: padding;
padding: 4px;
subcontrol-position: top right;
width: 18px;
}}
QComboBox::down-arrow {{
image: url(icons:chevron-down.svg);
}}
"""
if is_win and platform.release() == "10":
# day mode is missing a bottom border; background must be