summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@idiap.ch>2019-01-11 23:48:11 +0100
committerSamuel Gaist <samuel.gaist@idiap.ch>2019-07-29 20:01:20 +0200
commit036e9d66f50f829299ac98debbf42b255f3b810c (patch)
tree475cc0e58d5eff965bf25aea0aae0189d901bbf7 /src/plugins
parent7cf9f4e3d36dda31d1339990d6454dcf62e93055 (diff)
Fix CC_Slider rendering on macOS
QSlider rendering is currently broken as the context used to render it is not properly translated. This patch fixes that. Fixes: QTBUG-72970 Change-Id: I30896ceee1f37f6dfcf01a342d10af3bb279ac8a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 258aba2cda..c162cca048 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -5273,9 +5273,20 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
}
d->drawNSViewInRect(slider, opt->rect, p, ^(CGContextRef ctx, const CGRect &rect) {
- if (isHorizontal && sl->upsideDown) {
- CGContextTranslateCTM(ctx, rect.size.width, 0);
- CGContextScaleCTM(ctx, -1, 1);
+
+ // Since the GC is flipped, upsideDown means *not* inverted when vertical.
+ const bool verticalFlip = !isHorizontal && !sl->upsideDown; // FIXME: && !isSierraOrLater
+
+ if (isHorizontal) {
+ if (sl->upsideDown) {
+ CGContextTranslateCTM(ctx, rect.size.width, rect.origin.y);
+ CGContextScaleCTM(ctx, -1, 1);
+ } else {
+ CGContextTranslateCTM(ctx, 0, rect.origin.y);
+ }
+ } else if (verticalFlip) {
+ CGContextTranslateCTM(ctx, rect.origin.x, rect.size.height);
+ CGContextScaleCTM(ctx, 1, -1);
}
if (hasDoubleTicks) {
@@ -5286,9 +5297,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
CGContextTranslateCTM(ctx, 1, 0);
}
- // Since the GC is flipped, upsideDown means *not* inverted when vertical.
- const bool verticalFlip = !isHorizontal && !sl->upsideDown; // FIXME: && !isSierraOrLater
-
#if 0
// FIXME: Sadly, this part doesn't work. It seems to somehow polute the
// NSSlider's internal state and, when we need to use the "else" part,
@@ -5352,9 +5360,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// This ain't HIG kosher: force round knob look.
if (hasDoubleTicks)
slider.numberOfTickMarks = 0;
- // Draw the knob in the symmetrical position instead of flipping.
- if (verticalFlip)
- slider.intValue = slider.maxValue - slider.intValue + slider.minValue;
[cell drawKnob];
}
}