summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-04-24 09:52:30 +0200
committerLiang Qi <liang.qi@qt.io>2019-04-24 09:52:30 +0200
commitdc373186841802f2dd17fcd243efdeca7d5433e9 (patch)
tree4fff0a3366b63db97ca5a8b04a220bb0b8c56450 /src/plugins/styles
parent7d646508c8219408f90103ed13613db8d01a4065 (diff)
parentcb10ec56f733c34d23c9e5511b19c1e508d0f13f (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/gui/util/qshaderformat.cpp src/gui/util/qshaderformat_p.h src/widgets/graphicsview/qgraphicsitem_p.h Change-Id: Idafd88eb9a0a15b4af29f6143d009c1ec8ceecca
Diffstat (limited to 'src/plugins/styles')
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm71
1 files changed, 2 insertions, 69 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index d0e05c1e20..6d6648c1fa 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -1156,66 +1156,6 @@ static QStyleHelper::WidgetSizePolicy qt_aqua_guess_size(const QWidget *widg, QS
}
#endif
-static NSColor *qt_convertColorForContext(CGContextRef context, NSColor *color)
-{
- Q_ASSERT(color);
- Q_ASSERT(context);
-
- CGColorSpaceRef targetCGColorSpace = CGBitmapContextGetColorSpace(context);
- NSColorSpace *targetNSColorSpace = [[NSColorSpace alloc] initWithCGColorSpace:targetCGColorSpace];
- NSColor *adjusted = [color colorUsingColorSpace:targetNSColorSpace];
- [targetNSColorSpace release];
-
- return adjusted;
-}
-
-static NSColor *qt_colorForContext(CGContextRef context, const CGFloat (&rgba)[4])
-{
- Q_ASSERT(context);
-
- auto colorSpace = CGBitmapContextGetColorSpace(context);
- if (!colorSpace)
- return nil;
-
- return qt_convertColorForContext(context, [NSColor colorWithSRGBRed:rgba[0] green:rgba[1] blue:rgba[2] alpha:rgba[3]]);
-}
-
-static void qt_drawDisclosureButton(CGContextRef context, NSInteger state, bool selected, CGRect rect)
-{
- Q_ASSERT(context);
-
- static const CGFloat gray[] = {0.55, 0.55, 0.55, 0.97};
- static const CGFloat white[] = {1.0, 1.0, 1.0, 0.9};
-
- NSColor *fillColor = qt_colorForContext(context, selected ? white : gray);
- [fillColor setFill];
-
- if (state == NSOffState) {
- static NSBezierPath *triangle = [[NSBezierPath alloc] init];
- [triangle removeAllPoints];
- // In off state, a disclosure button is an equilateral triangle
- // ('pointing' to the right) with a bound rect that can be described
- // as NSMakeRect(0, 0, 8, 9). Inside the 'rect' it's translated by
- // (2, 4).
- [triangle moveToPoint:NSMakePoint(rect.origin.x + 2, rect.origin.y + 4)];
- [triangle lineToPoint:NSMakePoint(rect.origin.x + 2, rect.origin.y + 4 + 9)];
- [triangle lineToPoint:NSMakePoint(rect.origin.x + 2 + 8, rect.origin.y + 4 + 4.5)];
- [triangle closePath];
- [triangle fill];
- } else {
- static NSBezierPath *openTriangle = [[NSBezierPath alloc] init];
- [openTriangle removeAllPoints];
- // In 'on' state, the button is an equilateral triangle (looking down)
- // with the bounding rect NSMakeRect(0, 0, 9, 8). Inside the 'rect'
- // it's translated by (1, 4).
- [openTriangle moveToPoint:NSMakePoint(rect.origin.x + 1, rect.origin.y + 4 + 8)];
- [openTriangle lineToPoint:NSMakePoint(rect.origin.x + 1 + 9, rect.origin.y + 4 + 8)];
- [openTriangle lineToPoint:NSMakePoint(rect.origin.x + 1 + 4.5, rect.origin.y + 4)];
- [openTriangle closePath];
- [openTriangle fill];
- }
-}
-
void QMacStylePrivate::drawFocusRing(QPainter *p, const QRectF &targetRect, int hMargin, int vMargin, const CocoaControl &cw) const
{
QPainterPath focusRingPath;
@@ -3301,15 +3241,8 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
CGContextScaleCTM(cg, 1, -1);
CGContextTranslateCTM(cg, -rect.origin.x, -rect.origin.y);
- if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave && !qt_mac_applicationIsInDarkMode()) {
- // When the real system theme is one of the 'Dark' themes, and an application forces the 'Aqua' theme,
- // under some conditions (see QTBUG-74515 for more details) NSButtonCell seems to select the 'Dark'
- // code path and is becoming transparent, thus 'invisible' on the white background. To workaround this,
- // we draw the disclose triangle manually:
- qt_drawDisclosureButton(cg, triangleCell.state, (opt->state & State_Selected) && viewHasFocus, rect);
- } else {
- [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]];
- }
+ [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]];
+
d->restoreNSGraphicsContext(cg);
break; }