diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 22 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 52d39759dc..c17f5c6e2e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1411,6 +1411,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO win->setProperty(propertyName, q->property(propertyName)); } +#ifdef Q_OS_OSX + if (q->testAttribute(Qt::WA_ShowWithoutActivating)) + win->setProperty("_q_showWithoutActivating", QVariant(true)); +#endif win->setFlags(data.window_flags); fixPosIncludesFrame(); if (q->testAttribute(Qt::WA_Moved) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index f03a7796d9..531f538820 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -100,13 +100,14 @@ QT_USE_NAMESPACE -@interface NotificationReceiver : NSObject { +@interface QT_MANGLE_NAMESPACE(NotificationReceiver) : NSObject { QMacStylePrivate *mPrivate; } - (id)initWithPrivate:(QMacStylePrivate *)priv; - (void)scrollBarStyleDidChange:(NSNotification *)notification; @end +QT_NAMESPACE_ALIAS_OBJC_CLASS(NotificationReceiver); @implementation NotificationReceiver - (id)initWithPrivate:(QMacStylePrivate *)priv @@ -4045,11 +4046,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: |