Fix spinbox arrows under custom QSS
Inject CSS triangle arrows using palette(text) color when the user's QSS doesn't already style QSpinBox buttons.
This commit is contained in:
parent
fefc8c7fd5
commit
24146d49db
@ -1809,6 +1809,28 @@ def run() -> None:
|
|||||||
# Use Fusion style so QSS has full control over rendering
|
# Use Fusion style so QSS has full control over rendering
|
||||||
app.setStyle("Fusion")
|
app.setStyle("Fusion")
|
||||||
css_text = custom_css.read_text()
|
css_text = custom_css.read_text()
|
||||||
|
# Inject spinbox arrow fix if not already styled
|
||||||
|
if "QSpinBox::up-button" not in css_text:
|
||||||
|
css_text += """
|
||||||
|
QSpinBox::up-button, QSpinBox::down-button {
|
||||||
|
width: 16px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
QSpinBox::up-arrow {
|
||||||
|
image: none;
|
||||||
|
border-left: 4px solid transparent;
|
||||||
|
border-right: 4px solid transparent;
|
||||||
|
border-bottom: 5px solid palette(text);
|
||||||
|
width: 0; height: 0;
|
||||||
|
}
|
||||||
|
QSpinBox::down-arrow {
|
||||||
|
image: none;
|
||||||
|
border-left: 4px solid transparent;
|
||||||
|
border-right: 4px solid transparent;
|
||||||
|
border-top: 5px solid palette(text);
|
||||||
|
width: 0; height: 0;
|
||||||
|
}
|
||||||
|
"""
|
||||||
app.setStyleSheet(css_text)
|
app.setStyleSheet(css_text)
|
||||||
# Extract selection color from QSS and apply to palette
|
# Extract selection color from QSS and apply to palette
|
||||||
import re
|
import re
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user