summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-08-17 10:32:50 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-08-18 12:40:01 +0000
commitdfdb94410a3b77381f20e426a2420065be9631f9 (patch)
tree71b679d3ca79ca51e6646759b6111248b809c028 /src/plugins/platforms
parent3ce555a3de71725e83cd4e6cbd4da9ca1bc7ba20 (diff)
Revert "macOS: Create NSView as initially hidden, to match QWindow behavior"
It seems to break the ability to grab an offscreen QQuickView. That in turn breaks the tst_qquickimage::hugeImages autotest. This reverts commit 096b56f336e5bb994d46f073d55496d36d38e6b1. Task-number: QTBUG-62548 Change-Id: I11ce452341bfc2cc3cbc832b613c7366049b31d5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 6cdabf606b..e8550887cb 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -178,11 +178,6 @@ void QCocoaWindow::initialize()
if (!m_view) {
m_view = [[QNSView alloc] initWithCocoaWindow:this];
-
- // NSViews are visible by default, as opposed to QWindows which are not,
- // so make the view hidden until we receive an explicit setVisible.
- m_view.hidden = YES;
-
// Enable high-dpi OpenGL for retina displays. Enabling has the side
// effect that Cocoa will start calling glViewport(0, 0, width, height),
// overriding any glViewport calls in application code. This is usually not a
@@ -348,10 +343,8 @@ void QCocoaWindow::setVisible(bool visible)
&& !(nativeParentWindow.styleMask & NSFullScreenWindowMask))
nativeParentWindow.styleMask &= ~NSResizableWindowMask;
}
- }
- // Make the NSView visible first, before showing the NSWindow (in case of top level windows)
- m_view.hidden = NO;
+ }
if (isContentView()) {
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
@@ -402,6 +395,11 @@ void QCocoaWindow::setVisible(bool visible)
}
}
}
+ // In some cases, e.g. QDockWidget, the content view is hidden before moving to its own
+ // Cocoa window, and then shown again. Therefore, we test for the view being hidden even
+ // if it's attached to an NSWindow.
+ if ([m_view isHidden])
+ [m_view setHidden:NO];
} else {
// qDebug() << "close" << this;
#ifndef QT_NO_OPENGL
@@ -437,7 +435,7 @@ void QCocoaWindow::setVisible(bool visible)
[mainWindow makeKeyWindow];
}
} else {
- m_view.hidden = YES;
+ [m_view setHidden:YES];
}
removeMonitor();
@@ -1246,6 +1244,7 @@ void QCocoaWindow::recreateWindowIfNeeded()
rect.setSize(QSize(1, 1));
NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
[m_view setFrame:frame];
+ [m_view setHidden:!window()->isVisible()];
}
const qreal opacity = qt_window_private(window())->opacity;