Mac: build fix
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>
Tue, 2 Aug 2011 13:17:10 +0000 (15:17 +0200)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>
Tue, 2 Aug 2011 13:58:40 +0000 (15:58 +0200)
qtbase failed building on Mac OS 10.5 and 10.6. This patch
just rearrange some headers etc

Change-Id: If85ac69029533a195249e84f8803ced6c0ff22b6
Reviewed-on: http://codereview.qt.nokia.com/2517
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
src/widgets/widgets/qmenu_mac.mm
tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp

index 070ecfb..42f2422 100644 (file)
 
 struct HIContentBorderMetrics;
 
-#ifdef Q_WS_MAC32
-typedef struct _NSPoint NSPoint; // Just redefine here so I don't have to pull in all of Cocoa.
+#ifdef __OBJC__
+    // If the source file including this file also includes e.g. Cocoa/Cocoa.h, typedef-ing NSPoint will
+    // fail since NSPoint will already be a type. So we try to detect this. If the build fails, ensure
+    // that the inclusion of cocoa headers happends before the inclusion of this file.
+    #include <Foundation/NSGeometry.h>
 #else
-typedef struct CGPoint NSPoint;
+    #ifdef Q_WS_MAC32
+        typedef struct _NSPoint NSPoint; // Just redefine here so I don't have to pull in all of Cocoa.
+    #else
+        typedef struct CGPoint NSPoint;
+    #endif
 #endif
 
 QT_BEGIN_NAMESPACE
index 7d3bd39..09c7af7 100644 (file)
@@ -39,6 +39,8 @@
 **
 ****************************************************************************/
 
+#include <Cocoa/Cocoa.h>
+
 #include "qmenu.h"
 #include "qhash.h"
 #include <qdebug.h>
@@ -60,7 +62,6 @@
 #include <private/qcocoamenuloader_mac_p.h>
 #include <private/qcocoamenu_mac_p.h>
 #include <private/qt_cocoa_helpers_mac_p.h>
-#include <Cocoa/Cocoa.h>
 
 QT_BEGIN_NAMESPACE
 
index 11d297c..2bfd41c 100644 (file)
@@ -542,7 +542,6 @@ void tst_QStyleSheetStyle::dynamicProperty()
 }
 
 #ifdef Q_OS_MAC
-#include <QtGui/QMacStyle>
 void tst_QStyleSheetStyle::layoutSpacing()
 {
     qApp->setStyleSheet("* { color: red }");