diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2013-06-19 12:27:51 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-29 12:44:07 +0200 |
commit | 1e14762b8d79118540bd09a84dd3e48f4f5e113e (patch) | |
tree | f06cb1b7ccb161f3495d2c1abb941c2911a50314 /src/plugins/platforms/cocoa/qcocoaapplication.h | |
parent | ee9b9d9fd9a714f97ed8f7e26404c2f113588e9c (diff) | |
download | qtbase-1e14762b8d79118540bd09a84dd3e48f4f5e113e.tar.gz |
Make QGuiApplication::exec() run within NSApplicationMain()
We follow the same pattern as for iOS and Windows ports, making
sure the user's main() runs in a platform friendly environment. In
this particular case, it means calling the user's main() during the
call of NSApplicationMain(), and calling the user's main() function
(renamed to qMain() as in Windows) after receiving
NSApplicationDidFinishLaunchingNotification. In practice, this means
that NSApp is running when qMain() is called, and therefore when
QCoreApplication::exec() is called.
For those command-line utilities running on QGuiApplication, or any
deriving class, and that do not provide a bundle, we override the main
bundle's dictionary and get NSApplicationMain() to run as usual.
Added cocoa/cocoamain "subdir" to build libqtcocoamain.a (together with
cocoa/cocoaplugin -- plugins/platforms/cocoa is made a subdirs project).
This library is linked against all GUI Qt apps and provides the actual
main() function. It also catches the launching NSApplication notifications,
and calls the user's qMain() function. Note that this will happen in the
same cases when the user's application will run with the Cocoa QPA plugin.
Launch related code in QCocoaApplicationDelegate is moved to libqtcocoamain,
QNSApplication is removed (but sendEvent: redirection still there), and
code in QCocoaEventDispatcher dealing with calling [NSApp run] and related
has been removed since it's become unreachable.
ChangeLog: [Qt for Mac] Make QGuiApplication::exec() run within NSApplicationMain()
Change-Id: I790e5138c29aac2e0215a9147d0148fece40ca22
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaapplication.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaapplication.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.h b/src/plugins/platforms/cocoa/qcocoaapplication.h index ffb12ea846..b01f3ca93e 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.h +++ b/src/plugins/platforms/cocoa/qcocoaapplication.h @@ -102,13 +102,9 @@ - (void)qt_sendPostedMessage:(NSEvent *)event; - (BOOL)qt_filterEvent:(NSEvent *)event; +- (BOOL)qt_filterOrSendEvent:(NSEvent *)event; @end -@interface QT_MANGLE_NAMESPACE(QNSApplication) : NSApplication { -} -@end - -QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSApplication); QT_BEGIN_NAMESPACE |