From 67f9002981eae862291f5207d0b0246f4a0c80fc Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 2 Aug 2011 15:17:10 +0200 Subject: [PATCH] Mac: build fix 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 Reviewed-by: Qt Sanity Bot Reviewed-by: Gabriel de Dietrich --- src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h | 13 ++++++++++--- src/widgets/widgets/qmenu_mac.mm | 3 ++- .../auto/qstylesheetstyle/tst_qstylesheetstyle.cpp | 1 - 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h index 070ecfb030..42f242276e 100644 --- a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h +++ b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h @@ -111,10 +111,17 @@ 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 #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 diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index 7d3bd3939c..09c7af7749 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#include + #include "qmenu.h" #include "qhash.h" #include @@ -60,7 +62,6 @@ #include #include #include -#include QT_BEGIN_NAMESPACE diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 11d297cdac..2bfd41ccd1 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -542,7 +542,6 @@ void tst_QStyleSheetStyle::dynamicProperty() } #ifdef Q_OS_MAC -#include void tst_QStyleSheetStyle::layoutSpacing() { qApp->setStyleSheet("* { color: red }");