From 0c5f294217e0003a74c97f6326dd9654f13199ea Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 24 Oct 2022 17:58:12 +0200 Subject: [PATCH] qnswindow (-backgroundColor) - return 'clear color' for Qt::Popup That's what we initially did for borderless windows and we need it in order to draw rounded corners for context menus. Fixes: QTBUG-106108 Change-Id: I6e4254b714ad7a094aa295546d5ac7fba5e21b13 Reviewed-by: Qt CI Bot Reviewed-by: Volker Hilsheimer (cherry picked from commit 6a839e0ae4cb1eddd290d64b152a2571f3586ed2) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qnswindow.mm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index cce76e4b209..8d4a0617de9 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -296,8 +296,13 @@ OSStatus CGSClearWindowTags(const CGSConnectionID, const CGSWindowID, int *, int // 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]; + if (!self.opaque && window) { + // Qt::Popup also requires clearColor - in qmacstyle + // we fill background using a special path with rounded corners. + if (window->flags().testFlag(Qt::FramelessWindowHint) + || (window->flags() & Qt::WindowType_Mask) == Qt::Popup) + return [NSColor clearColor]; + } // This still allows you to have translucent content with a frame, // where the system background (or color set via NSWindow) will