mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Add QMenu stylesheet
This commit is contained in:
parent
2c0a1dd298
commit
95b715427d
3 changed files with 44 additions and 10 deletions
|
@ -28,7 +28,8 @@ qlineargradient(
|
||||||
|
|
||||||
def general_styles(tm: ThemeManager) -> str:
|
def general_styles(tm: ThemeManager) -> str:
|
||||||
return f"""
|
return f"""
|
||||||
QFrame {{
|
QFrame,
|
||||||
|
QWidget {{
|
||||||
background: none;
|
background: none;
|
||||||
}}
|
}}
|
||||||
QPushButton,
|
QPushButton,
|
||||||
|
@ -61,6 +62,36 @@ QToolTip {{
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def menu_styles(tm: ThemeManager()) -> str:
|
||||||
|
return f"""
|
||||||
|
QMenu {{
|
||||||
|
background-color: {tm.var(colors.CANVAS_OVERLAY)};
|
||||||
|
border: 1px solid {tm.var(colors.BORDER)};
|
||||||
|
padding: 4px;
|
||||||
|
}}
|
||||||
|
QMenu::item {{
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 3px 10px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
min-width: 120px;
|
||||||
|
}}
|
||||||
|
QMenu::item:selected {{
|
||||||
|
background-color: {tm.var(colors.HIGHLIGHT_BG)};
|
||||||
|
color: {tm.var(colors.HIGHLIGHT_FG)};
|
||||||
|
border-radius: {tm.var(props.BORDER_RADIUS)};
|
||||||
|
}}
|
||||||
|
QMenu::separator {{
|
||||||
|
height: 1px;
|
||||||
|
background: {tm.var(colors.BORDER)};
|
||||||
|
margin: 0 8px 4px 8px;
|
||||||
|
}}
|
||||||
|
QMenu::indicator {{
|
||||||
|
border-color: {tm.var(colors.BORDER_STRONG)};
|
||||||
|
margin-left: 2px;
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def button_styles(tm: ThemeManager) -> str:
|
def button_styles(tm: ThemeManager) -> str:
|
||||||
return f"""
|
return f"""
|
||||||
QPushButton,
|
QPushButton,
|
||||||
|
@ -374,16 +405,16 @@ QRadioButton {{
|
||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
}}
|
}}
|
||||||
QCheckBox::indicator,
|
QCheckBox::indicator,
|
||||||
QRadioButton::indicator {{
|
QRadioButton::indicator,
|
||||||
|
QMenu::indicator {{
|
||||||
border: 1px solid {tm.var(colors.BUTTON_BORDER)};
|
border: 1px solid {tm.var(colors.BUTTON_BORDER)};
|
||||||
|
border-radius: {tm.var(props.BORDER_RADIUS)};
|
||||||
background: {tm.var(colors.CANVAS_INSET)};
|
background: {tm.var(colors.CANVAS_INSET)};
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
}}
|
}}
|
||||||
QCheckBox::indicator {{
|
QRadioButton::indicator,
|
||||||
border-radius: {tm.var(props.BORDER_RADIUS)};
|
QMenu::indicator:exclusive {{
|
||||||
}}
|
|
||||||
QRadioButton::indicator {{
|
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}}
|
}}
|
||||||
QCheckBox::indicator:hover,
|
QCheckBox::indicator:hover,
|
||||||
|
@ -395,7 +426,8 @@ QRadioButton::indicator:checked:hover {{
|
||||||
height: 14px;
|
height: 14px;
|
||||||
}}
|
}}
|
||||||
QCheckBox::indicator:checked,
|
QCheckBox::indicator:checked,
|
||||||
QRadioButton::indicator:checked {{
|
QRadioButton::indicator:checked,
|
||||||
|
QMenu::indicator:checked {{
|
||||||
image: url({tm.themed_icon("mdi:check")});
|
image: url({tm.themed_icon("mdi:check")});
|
||||||
}}
|
}}
|
||||||
QCheckBox::indicator:indeterminate {{
|
QCheckBox::indicator:indeterminate {{
|
||||||
|
|
|
@ -218,6 +218,7 @@ class ThemeManager:
|
||||||
checkbox_styles,
|
checkbox_styles,
|
||||||
combobox_styles,
|
combobox_styles,
|
||||||
general_styles,
|
general_styles,
|
||||||
|
menu_styles,
|
||||||
scrollbar_styles,
|
scrollbar_styles,
|
||||||
spinbox_styles,
|
spinbox_styles,
|
||||||
table_styles,
|
table_styles,
|
||||||
|
@ -229,11 +230,12 @@ class ThemeManager:
|
||||||
[
|
[
|
||||||
general_styles(self),
|
general_styles(self),
|
||||||
button_styles(self),
|
button_styles(self),
|
||||||
|
checkbox_styles(self),
|
||||||
|
menu_styles(self),
|
||||||
combobox_styles(self),
|
combobox_styles(self),
|
||||||
tabwidget_styles(self),
|
tabwidget_styles(self),
|
||||||
table_styles(self),
|
table_styles(self),
|
||||||
spinbox_styles(self),
|
spinbox_styles(self),
|
||||||
checkbox_styles(self),
|
|
||||||
scrollbar_styles(self),
|
scrollbar_styles(self),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -56,8 +56,8 @@ $vars: (
|
||||||
dark: palette(darkgray, 6),
|
dark: palette(darkgray, 6),
|
||||||
),
|
),
|
||||||
overlay: (
|
overlay: (
|
||||||
light: white,
|
light: palette(lightgray, 0),
|
||||||
dark: black,
|
dark: palette(darkgray, 5),
|
||||||
),
|
),
|
||||||
code: (
|
code: (
|
||||||
light: white,
|
light: white,
|
||||||
|
|
Loading…
Reference in a new issue