summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-12-20 16:47:01 -0800
committerLiang Qi <liang.qi@qt.io>2017-12-21 20:53:20 +0000
commite3c79b4356ca0d777663e7c4ad673dcb428b76b0 (patch)
tree2b637a5629d996623513cac73f5f6114d5e12a4e /src/plugins/styles
parent117148c381316c046b99a4ce40ab668fb7c79f11 (diff)
QMacStyle: Use light color on expanding scrollbar
Change-Id: I4e9c870c8acaaa690f530f847c9927d61a508a94 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 386e944e42..ad2ca4a02e 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -5174,11 +5174,11 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
const auto cw = QMacStylePrivate::CocoaControl(controlType, cocoaSize);
NSScroller *scroller = static_cast<NSScroller *>(d->cocoaControl(cw));
+ const QColor bgColor = QStyleHelper::backgroundColor(opt->palette, widget);
+ const bool hasDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128;
if (isTransient) {
// macOS behavior: as soon as one color channel is >= 128,
// the background is considered bright, scroller is dark.
- const QColor bgColor = QStyleHelper::backgroundColor(opt->palette, widget);
- const bool hasDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128;
scroller.knobStyle = hasDarkBg? NSScrollerKnobStyleLight : NSScrollerKnobStyleDark;
} else {
scroller.knobStyle = NSScrollerKnobStyleDefault;
@@ -5228,7 +5228,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QCFType<CGPathRef> knobPath = CGPathCreateWithRoundedRect(knobRect, knobRadius, knobRadius, nullptr);
CGContextAddPath(cg, knobPath);
CGContextSetAlpha(cg, 0.5);
- CGContextSetFillColorWithColor(cg, NSColor.blackColor.CGColor);
+ CGColorRef knobColor = hasDarkBg ? NSColor.whiteColor.CGColor : NSColor.blackColor.CGColor;
+ CGContextSetFillColorWithColor(cg, knobColor);
CGContextFillPath(cg);
} else {
[scroller drawKnob];