diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-14 11:52:09 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-28 09:07:28 +0000 |
commit | b0e4c8f427eaed8ce392be95e08913d2efe1d3a2 (patch) | |
tree | 7fb96c379be457fb320828788973d84af2e3f6ee /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | 84cc43413a8577245701e6890d821e3c701a2fb1 (diff) |
Remove requirement to call QWindow::setMask after creating window
Like other QWindow properties we can just store it, and the platform
window should pick it up on creation like other properties.
[ChangeLog][QtGui][QWindow] setMask() no longer requires the window
to be created to have an effect; it can be set at any time.
Change-Id: I55b616363801b770bd61bda5325b443013b99866
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index c9e2cdaf93..4bf65d9f5b 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -54,6 +54,7 @@ #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformscreen.h> #include <QtGui/private/qcoregraphics_p.h> +#include <QtGui/private/qhighdpiscaling_p.h> #include <AppKit/AppKit.h> @@ -764,7 +765,7 @@ void QCocoaWindow::setMask(const QRegion ®ion) { qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::setMask" << window() << region; if (isContentView()) - m_view.window.backgroundColor = [NSColor clearColor]; + m_view.window.backgroundColor = !region.isEmpty() ? [NSColor clearColor] : nil; [qnsview_cast(m_view) setMaskRegion:®ion]; m_view.window.opaque = isOpaque(); @@ -1167,6 +1168,8 @@ void QCocoaWindow::recreateWindowIfNeeded() if (!qFuzzyCompare(opacity, qreal(1.0))) setOpacity(opacity); + setMask(QHighDpi::toNativeLocalRegion(window()->mask(), window())); + // top-level QWindows may have an attached NSToolBar, call // update function which will attach to the NSWindow. if (!parentWindow) |