more style fixes

This commit is contained in:
Talley Lambert
2021-04-26 12:26:20 -04:00
parent 59c5dec044
commit 2897a18851

View File

@@ -43,15 +43,17 @@ class RangeSliderStyle:
}[cg]
val = getattr(self, attr) or getattr(SYSTEM_STYLE, attr)
if isinstance(val, str):
val = QColor(val)
_val = QColor(val)
if not _val.isValid():
_val = parse_color(val)
if not val:
if not _val:
return Qt.NoBrush
if opt.tickPosition != QSlider.NoTicks:
val.setAlphaF(self.tick_bar_alpha or SYSTEM_STYLE.tick_bar_alpha)
_val.setAlphaF(self.tick_bar_alpha or SYSTEM_STYLE.tick_bar_alpha)
return val
return _val
def pen(self, opt: QStyleOptionSlider) -> Union[Qt.PenStyle, QColor]:
cg = opt.palette.currentColorGroup()
@@ -209,7 +211,7 @@ rgba_pattern = re.compile(
)
def parse_color(color: str) -> Union[str, QGradient]:
def parse_color(color: str) -> Union[QColor, QGradient]:
qc = QColor(color)
if qc.isValid():
return qc
@@ -236,7 +238,7 @@ def parse_color(color: str) -> Union[str, QGradient]:
return grad
# fallback to dark gray
return "#333"
return QColor("#333")
def update_styles_from_stylesheet(obj: "QRangeSlider"):