diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index d4c1593936..242d442a19 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -529,10 +529,8 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) if (frameless) { // Frameless windows do not display the traffic lights buttons for // e.g. minimize, however StyleMaskMiniaturizable is required to allow - // programatic minimize. However, for framless tool windows (e.g. dock windows) - // we don't want that, as it breaks translucency. - if (type != Qt::Tool) - styleMask |= NSWindowStyleMaskMiniaturizable; + // programmatic minimize. + styleMask |= NSWindowStyleMaskMiniaturizable; } else if (flags & Qt::CustomizeWindowHint) { if (flags & Qt::WindowTitleHint) styleMask |= NSWindowStyleMaskTitled; diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index 1fa11e2789..82daccc68c 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -324,8 +324,18 @@ OSStatus CGSClearWindowTags(const CGSConnectionID, const CGSWindowID, int *, int - (NSColor *)backgroundColor { - return self.styleMask == NSWindowStyleMaskBorderless ? - [NSColor clearColor] : [super backgroundColor]; + // FIXME: Plumb to a WA_NoSystemBackground-like window flag, + // or a QWindow::backgroundColor() property. In the meantime + // we assume that if you have translucent content, without a + // frame then you intend to do all background drawing yourself. + const QWindow *window = m_platformWindow ? m_platformWindow->window() : nullptr; + if (!self.opaque && window && window->flags().testFlag(Qt::FramelessWindowHint)) + return [NSColor clearColor]; + + // This still allows you to have translucent content with a frame, + // where the system background (or color set via NSWindow) will + // shine through. + return [super backgroundColor]; } - (void)sendEvent:(NSEvent*)theEvent diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index fcb18d7c18..7e0d2c7291 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -792,6 +792,8 @@ void QWidget::setAutoFillBackground(bool enabled) and a compositing window manager. \li Windows: The widget needs to have the Qt::FramelessWindowHint window flag set for the translucency to work. + \li \macos: The widget needs to have the Qt::FramelessWindowHint window flag set + for the translucency to work. \endlist