summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 0084bf68dc..d647acdacc 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -4044,11 +4044,20 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
break;
case CE_FocusFrame: {
- int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w) + 1;
- int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w) + 1;
- HIRect hirect = CGRectMake(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff,
- opt->rect.height() - 2 * yOff);
- HIThemeDrawFocusRect(&hirect, true, QMacCGContext(p), kHIThemeOrientationNormal);
+ int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w);
+ int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w);
+ NSRect rect = NSMakeRect(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff,
+ opt->rect.height() - 2 * yOff);
+ CGContextSaveGState(cg);
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext
+ graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]];
+ [NSGraphicsContext saveGraphicsState];
+ NSSetFocusRingStyle(NSFocusRingOnly);
+ NSBezierPath *focusFramePath = [NSBezierPath bezierPathWithRect:rect];
+ [focusFramePath setClip]; // Clear clip path to avoid artifacts when rendering the cursor at zero pos
+ [focusFramePath fill];
+ [NSGraphicsContext restoreGraphicsState];
+ CGContextRestoreGState(cg);
break; }
case CE_MenuItem:
case CE_MenuEmptyArea: