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.

Pick-to: 6.4 6.2
Fixes: QTBUG-106108
Change-Id: I6e4254b714ad7a094aa295546d5ac7fba5e21b13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Timur Pocheptsov 2022-10-24 17:58:12 +02:00
parent 737011dd02
commit 6a839e0ae4

View File

@ -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