summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qtmain.mm
Commit message (Collapse)AuthorAgeFilesLines
* iOS: Remove need for separate qtiosmain libraryTor Arne Vestbø2013-06-121-94/+0
| | | | | | | | | | | | | | | | | | | | We can combine the hybrid and non-hybrid use-cases into a single static library if we are careful about which symbols are included in which object files. By limiting the main() and qt_user_main() functions to their own translation units, the linker will only pick them up if they are missing at link time (the user's program do not provide them). This technique is resilient to the -ObjC linker flag, which includes all object files that implement an ObjectiveC class or category, but will fail if the -all_load flag is passed to the linker, as we'll then have duplicate symbols for either main() or qt_user_main(). The latter should not happen unless the user provides the flag manually, and in the case he or she does, there's ways to work around it by providing less global flags such as -ObjC or -force_load. Change-Id: Ie2f8e10a7265d007bf45cb1dd83f19cff0693551 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: use an explicit pointer to qiosViewControllerRichard Moe Gustavsen2013-04-191-1/+2
| | | | | | | | | | | | | As it stood, we always relied on the root view controller being a QIOSViewController if isQtApplication() returned true. For mixed application, this might not always be true as native code can choose to replace the root view controller at times, or even rip it out, and place it as a child of another (e.g UISplitViewController). This change will give an extra protection against that. Change-Id: I0cb85796a8b82f9037c32f9e85e04e1dc7aad8e2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Use didFinishLaunchingWithOptions to support iOS < 6.0Tor Arne Vestbø2013-03-191-2/+2
| | | | | | | | | UIApplicationDelegate's willFinishLaunchingWithOptions message was introduced in 6.0. For now we don't need to distinguish the two, so no need to use willFinishLaunchingWithOptions on iOS >= 6.0. Change-Id: Ic6c2c9d2901def5a5500b186ed57fbe8b8c556d1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Move debug background color setting and guard for release buildsTor Arne Vestbø2013-02-271-2/+2
| | | | | Change-Id: Ie9131c3dfe16045805b37bf8af9381f4f9929da6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Don't init our own base view for the root viewcontrollerTor Arne Vestbø2013-02-271-1/+0
| | | | | | | This is handled automatically by the default implementation. Change-Id: Ia9bd0143490e6f2507ede03f3654a2b0b00e3e3d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Auto-release the UIWindow and root view-controllerTor Arne Vestbø2013-02-271-4/+3
| | | | | | | They are retained properties. Change-Id: Id1808d93fe30950fc05e41375f00183e098bff0b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: Don't check for existing window in QIOSMainWrapperApplicationDelegateTor Arne Vestbø2013-02-271-12/+8
| | | | | | | | The delegate is only used when we control the application, so we know that there isn't any window yet. Change-Id: Ibd774cb4fd8ceaab6a181769d2792b569f490495 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* iOS: add QIOSViewControllerRichard Moe Gustavsen2013-02-271-1/+2
| | | | | | | | | | | | | We need our own viewcontroller to better control which orientations iOS can enter, and also ito be able to stop auto-rotation. We stop auto-rotation to happend by default, since this is how Qt wants it (it is seen as the responsibility of the application). Change-Id: Id07a96e355396752fffd28984af528aeb0b7c3e3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* iOS: Ensure UIApplicationMain is started before QApplication by wrapping main()Tor Arne Vestbø2013-02-271-0/+98
For the typical Qt app the developer will have an existing main() that looks something like: int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); return app.exec(); } To support this, we provide our own 'main' function in the qtmain static library that we link into the application, which calls UIApplicationMain and redirects to the 'main' function of the application after the event loop has started spinning. For this to work, the applications 'main' function needs to manually be renamed 'qt_main' for now. In a later patch, this renaming will happen automatically by redefining main from either a header file, or more likely, from the Makefile created by qmake. For the case of an iOS developer wanting to use Qt in their existing app the main will look something like: int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } This is supported right now by just linking in libqios.a without libqiosmain.a. QGuiApplication should then be created e.g inside the native apps application delegate (but QGuiApplication::exec should not be called). In the future, we plan to but use a wrapper library that brings in all the Qt dependencies into one single static library. This library will not link against qtmain, so there won't be a symbol clash if the -ObjC linker option is used. We should then add the required magic to the future Objective-C convenience wrapper for QML to bring up a QGuiApplication, which would allow using Qt from storyboards and NIBs. This would also be the place to inject our own application delegate into the mix, while proxying the delegate callbacks to the user's application delegate. Change-Id: Iba5ade114b27216be8285f36100fd735a08b9d59 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>