diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-09-04 17:56:30 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-09-27 20:44:17 +0000 |
commit | 126c2cb8fbb50848a5006fd25e83b8afc7b3e781 (patch) | |
tree | 237625fd169b89935233f8125931d9c3c0c24b49 /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | b2e664df614dea23bf77c0fa293682b47a8b5557 (diff) |
Clean up cancel operation handling on OS X
The logic for handling cancel operations was spread out through
the code base and sometimes hard-coded to only include the Escape
key shortcut, missing the Command+. shortcut.
We now intercept both attempts at cancel operations from the system
through cancelOperation, which we forward as normal key events.
A new QKeySequence::StandardKey has been added for the Cancel sequence,
which maps to Escape on all platforms, and Command+. in addition for
OS X. The hard-coded logic in QWidget and subclasses for dealing
with closing the dialogs has been replaced with this key sequence,
which allows clients to override the behavior. Note that the widget
code is not wrapped in checks for QT_NO_SHORTCUT, as we don't care
about keeping widgets building and working under that define.
The logic in QCocoaWindow to bypass windowShouldClose when delivering
IM events has been removed as we now handle that specific case by
also forwarding Escape as a cancel operation.
Task-number: QTBUG-47557
Task-number: QTBUG-45771
Task-number: QTBUG-44076
Change-Id: Ibe0b3a4819f8659d246a2142dd7d9cd3a826ef78
Reviewed-by: Tim Blechmann <tim@klingt.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 5606f050a3..8a8e03d283 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -345,7 +345,6 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_synchedWindowState(Qt::WindowActive) , m_windowModality(Qt::NonModal) , m_windowUnderMouse(false) - , m_ignoreWindowShouldClose(false) , m_inConstructor(true) , m_inSetVisible(false) , m_inSetGeometry(false) @@ -1219,9 +1218,10 @@ void QCocoaWindow::windowDidEndLiveResize() bool QCocoaWindow::windowShouldClose() { - // might have been set from qnsview.mm - if (m_ignoreWindowShouldClose) - return false; + // This callback should technically only determine if the window + // should (be allowed to) close, but since our QPA API to determine + // that also involves actually closing the window we do both at the + // same time, instead of doing the latter in windowWillClose. bool accepted = false; QWindowSystemInterface::handleCloseEvent(window(), &accepted); QWindowSystemInterface::flushWindowSystemEvents(); |