Add WindowFullscreenButtonHint.
authorMorten Johan Sørvig <morten.sorvig@digia.com>
Mon, 5 Nov 2012 21:20:47 +0000 (22:20 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 22 Nov 2012 23:47:48 +0000 (00:47 +0100)
Adds the fullscreen button on Mac OS X. Has no effect
on other platforms. Regarding the name I dropped the
"Mac" prefix (like MacWindowToolBarButtonHint). Other
platforms can use and we don't want to accumulate "Mac"
API's.

Change logic in QCocoaWindow check for this flag instead
of using WindowsMaximizebutton.

Change-Id: I9f2db75e8e71b3da36777c7e48852eda3ce9d534
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
src/corelib/global/qnamespace.h
src/corelib/global/qnamespace.qdoc
src/plugins/platforms/cocoa/qcocoawindow.mm

index 6430c85..d071bd2 100644 (file)
@@ -311,7 +311,8 @@ public:
         BypassGraphicsProxyWidget = 0x20000000,
         WindowOkButtonHint = 0x00080000,
         WindowCancelButtonHint = 0x00100000,
-        NoDropShadowWindowHint = 0x40000000
+        NoDropShadowWindowHint = 0x40000000,
+        WindowFullscreenButtonHint = 0x80000000
     };
 
     Q_DECLARE_FLAGS(WindowFlags, WindowType)
index 66442a8..903e17c 100644 (file)
     \value MacWindowToolBarButtonHint On Mac OS X adds a tool bar button (i.e.,
            the oblong button that is on the top right of windows that have toolbars).
 
+    \value WindowFullscreenButtonHint On Mac OS X adds a fullscreen button.
+
     \value BypassGraphicsProxyWidget Prevents the window and its children from
            automatically embedding themselves into a QGraphicsProxyWidget if the
            parent widget is already embedded. You can set this flag if you
index 321c0ea..e011d1c 100644 (file)
@@ -684,11 +684,10 @@ NSWindow * QCocoaWindow::createNSWindow()
         setWindowShadow(flags);
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
-    if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
-        // All windows with the WindowMaximizeButtonHint set also get a full-screen button.
-        if (flags & Qt::WindowMaximizeButtonHint)
-            [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
-    }
+        if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+            if (flags & Qt::WindowFullscreenButtonHint)
+                [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+        }
 #endif
 
         createdWindow = window;