summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-01-09 12:39:05 -0800
committerJake Petroules <jake.petroules@qt.io>2017-01-12 02:14:25 +0000
commita50ed8685fabeb477ec89ff73a3164f4a2b60687 (patch)
tree9f6ba226a77150726b547fddbbbd897f9c817829 /src
parent2b928ef6f95c528449d6ec9650325f3ccaac5094 (diff)
QCocoaWindow: Fix 10.10 sheet API deprecation warning
'beginSheet:modalForWindow:modalDelegate:didEndSelector: contextInfo:' is deprecated: first deprecated in macOS 10.10 - Use -[NSWindow beginSheet:completionHandler:] instead [-Wdeprecated-declarations] Similarly, although it won't emit any warning, we replace the usage of -[NSApplication endSheet:] wit -[NSWindow endSheet:]. Change-Id: Iae71247f818b7183d09c6831fa4cb1b71a54a87a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index c2f0122243..ea06bfca88 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -735,7 +735,7 @@ void QCocoaWindow::setVisible(bool visible)
|| window()->type() == Qt::Sheet)
&& parentCocoaWindow) {
// show the window as a sheet
- [NSApp beginSheet:m_nsWindow modalForWindow:parentCocoaWindow->m_nsWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
+ [parentCocoaWindow->m_nsWindow beginSheet:m_nsWindow completionHandler:nil];
} else if (window()->modality() != Qt::NonModal) {
// show the window as application modal
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
@@ -797,8 +797,10 @@ void QCocoaWindow::setVisible(bool visible)
cocoaEventDispatcherPrivate->endModalSession(window());
m_hasModalSession = false;
} else {
- if ([m_nsWindow isSheet])
- [NSApp endSheet:m_nsWindow];
+ if ([m_nsWindow isSheet]) {
+ Q_ASSERT_X(parentCocoaWindow, "QCocoaWindow", "Window modal dialog has no transient parent.");
+ [parentCocoaWindow->m_nsWindow endSheet:m_nsWindow];
+ }
}
hide();