Cocoa: Activate Qt apps on startup.
authorMorten Sorvig <morten.sorvig@nokia.com>
Thu, 11 Aug 2011 10:27:29 +0000 (12:27 +0200)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Thu, 11 Aug 2011 10:38:07 +0000 (12:38 +0200)
This prevents Qt apps from launching behind the
terminal and QProcess parent apps, which is the
native OS X but not the cross-platform Qt behavior.

This reverses the change made mid 4.x series and
reverts back to the "old" Qt 4 behavior

Change-Id: I99d9f95980db884f8614ec2df663305505e08531
Reviewed-on: http://codereview.qt.nokia.com/2858
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/plugins/platforms/cocoa/qcocoaintegration.mm

index 6c10ed6..3e03b1a 100644 (file)
@@ -80,6 +80,12 @@ QCocoaIntegration::QCocoaIntegration()
     [NSApplication sharedApplication];
 //    [[OurApplication alloc] init];
 
+    // Move the application window to front to avoid launching behind the terminal.
+    // Ignoring other apps is neccessary (we must ignore the terminal), but makes
+    // Qt apps play slightly less nice with other apps when lanching from Finder
+    // (See the activateIgnoringOtherApps docs.)
+    [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
+
     NSArray *screens = [NSScreen screens];
     for (uint i = 0; i < [screens count]; i++) {
         QCocoaScreen *screen = new QCocoaScreen(i);