From 9b36f48f59ceb1066cc215039c6d48224b8edd73 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 30 Jun 2020 18:04:07 +0200 Subject: QMacStyle - draw inverted vertical slider correctly Without double-inverting it (and having a knob and the blue filling mirroring each other relative to the center of the slider's bar). Pick-to: 5.15 Fixes: QTBUG-85342 Change-Id: I4f0e8dd6d76e5e078a2db5c2ca63ba6bb2a661ed Reviewed-by: Volker Hilsheimer --- src/plugins/styles/mac/qmacstyle_mac.mm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/plugins/styles/mac/qmacstyle_mac.mm') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index beeaa14924..91611f9db5 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -5395,7 +5395,18 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex const CGRect barRect = [cell barRectFlipped:hasTicks]; if (drawBar) { - [cell drawBarInside:barRect flipped:!verticalFlip]; + if (!isHorizontal && !sl->upsideDown && (hasDoubleTicks || !hasTicks)) { + // The logic behind verticalFlip and upsideDown is the twisted one. + // Bar is the only part of the cell affected by this 'flipped' + // parameter in the call below, all other parts (knob, etc.) 'fixed' + // by scaling/translating. With ticks on one side it's not a problem + // at all - the bar is gray anyway. Without ticks or with ticks on + // the both sides, for inverted appearance and vertical orientation - + // we must flip so that knob and blue filling work in accordance. + [cell drawBarInside:barRect flipped:true]; + } else { + [cell drawBarInside:barRect flipped:!verticalFlip]; + } // This ain't HIG kosher: force unfilled bar look. if (hasDoubleTicks) slider.numberOfTickMarks = numberOfTickMarks; -- cgit v1.2.3