Cocoa: Make QMacNativeWidget paint correctly

QWindows with transparent pixels (of which QMacNativeWidget
is an example) must be composited, even if they are
content views.

This will display the NSWindow background instead
of solid black for the areas where the Qt backingstore
has transparent pixels.

Change-Id: Ibee1327e11bc64975900b4c5d632dd5f103da4c8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2018-03-27 16:06:18 +02:00
parent dbdd5f0ffb
commit 306df144b4

View File

@ -163,9 +163,11 @@ void QCocoaBackingStore::flush(QWindow *window, const QRegion &region, const QPo
const qreal devicePixelRatio = m_image.devicePixelRatio();
// If the flushed window is a content view, and not in unified toolbar mode,
// we can get away with copying the backingstore instead of blending.
const NSCompositingOperation compositingOperation = static_cast<QCocoaWindow *>(
window->handle())->isContentView() && !windowHasUnifiedToolbar() ?
// and is fully opaque, we can get away with copying the backingstore instead
// of blending.
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
const NSCompositingOperation compositingOperation = cocoaWindow->isContentView()
&& cocoaWindow->isOpaque() && !windowHasUnifiedToolbar() ?
NSCompositingOperationCopy : NSCompositingOperationSourceOver;
#ifdef QT_DEBUG