diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-01-07 09:38:52 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2010-01-07 09:51:18 (GMT) |
commit | 4d786b6961f23af6edccf75c6b41267285fefcda (patch) | |
tree | fd6018118799f4a0297d338d33b3eda461b72c3a /src/gui/kernel | |
parent | 58112b1e251c03b0a72511508712f9a67ce84d25 (diff) | |
download | Qt-4d786b6961f23af6edccf75c6b41267285fefcda.zip Qt-4d786b6961f23af6edccf75c6b41267285fefcda.tar.gz Qt-4d786b6961f23af6edccf75c6b41267285fefcda.tar.bz2 |
Cocoa: problems quitting application when not using qApp::exec
This problem has been around before. At that time it had to do
with what part of the application received the kEAQuit apple event.
In Qt-4.7 we ensure that NSApplication gets run at least once
before we do any other event processing in Qt. That way the menu bar
gets fully initialized. The backside of the coin is that NSApplication
will not let the quit menu send a terminate action to the menu nibs file
owner (qmenuloader_mac.mm) when a modal window is showing on screen.
This is normally expected behaviour, but in Qt we allow the user to quit
when just a single window/dialog is showing on screen.
This fix remaps the quit items target from files owner to first responder.
That way we can catch the terminate at the window/responder beeing that,
and terminate as needed.
Task-number: QTBUG-7197
Reviewed-by: Prasanth
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/kernel.pri | 1 | ||||
-rw-r--r-- | src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index f2bd288..30cb043 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -201,6 +201,7 @@ embedded { OBJECTIVE_HEADERS += \ qcocoawindow_mac_p.h \ + qcocoapanel_mac_p.h \ qcocoawindowdelegate_mac_p.h \ qcocoaview_mac_p.h \ qcocoaapplication_mac_p.h \ diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index 7661b89..31d81d9 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -160,6 +160,13 @@ QT_END_NAMESPACE qt_dispatchTabletProximityEvent(tabletEvent); } +- (void)terminate:(id)sender +{ + // This function is called from the quit item in the + // menubar, when this window is the first responder + [NSApp terminate:sender]; +} + - (void)sendEvent:(NSEvent *)event { QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; |