Mac: Fix compilation with -qtnamespace set
authorKai Koehne <kai.koehne@nokia.com>
Mon, 30 Jan 2012 08:52:51 +0000 (09:52 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 31 Jan 2012 15:17:55 +0000 (16:17 +0100)
Change-Id: Id3b9f4e3edf2caeac32c8a44278cdf05a1fc70fb
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
src/plugins/platforms/cocoa/qnsview.h
src/widgets/styles/qmacstyle_mac.mm
tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp

index f3bb59d..80be157 100644 (file)
@@ -44,6 +44,8 @@
 #include <QtCore/QSettings>
 #import <Foundation/Foundation.h>
 
+QT_BEGIN_NAMESPACE
+
 // this could become a list of all languages used for each writing
 // system, instead of using the single most common language.
 static const char *languageForWritingSystem[] = {
@@ -320,6 +322,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString family, cons
     return fallbackLists[styleHint];
 }
 
+OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref);
 QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
 {
     ATSFontContainerRef fontContainer;
@@ -330,7 +333,6 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
                                       kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
                                       kATSOptionFlagsDefault, &fontContainer);
     } else {
-        OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref);
         FSRef ref;
         if (qt_mac_create_fsref(fileName, &ref) != noErr)
             return QStringList();
@@ -371,3 +373,5 @@ QFont QCoreTextFontDatabase::defaultFont() const
     return QFont(defaultFontName);
 }
 
+QT_END_NAMESPACE
+
index 08ab0b2..adcfeeb 100644 (file)
@@ -44,6 +44,8 @@
 
 #include <QPlatformFontDatabase>
 
+QT_BEGIN_NAMESPACE
+
 class QCoreTextFontDatabase : public QPlatformFontDatabase
 {
 public:
@@ -61,4 +63,6 @@ private:
     QHash<QFont::StyleHint, QStringList> fallbackLists;
 };
 
+QT_END_NAMESPACE
+
 #endif // QCORETEXTFONTDATABASE_H
index 6467dbc..c61ff2b 100644 (file)
 #include <QtGui/QImage>
 #include <QtGui/QAccessible>
 
+QT_BEGIN_NAMESPACE
 class QCocoaWindow;
+QT_END_NAMESPACE
+
 @interface QNSView : NSView {
     CGImageRef m_cgImage;
     QWindow *m_window;
index 6f5891e..09cb9cc 100644 (file)
@@ -2105,7 +2105,7 @@ void QMacStyle::unpolish(QWidget* w)
         }
     }
 
-    if (QRubberBand *rubber = ::qobject_cast<QRubberBand*>(w)) {
+    if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) {
         rubber->setWindowOpacity(1.0);
         rubber->setAttribute(Qt::WA_PaintOnScreen, true);
         rubber->setAttribute(Qt::WA_NoSystemBackground, true);
@@ -3538,7 +3538,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
         QCommonStyle::drawControl(ce, opt, p, w);
         break;
     case CE_PushButtonBevel:
-        if (const QStyleOptionButton *btn = ::qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+        if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
             if (!(btn->state & (State_Raised | State_Sunken | State_On)))
                 break;
 
index bdbd64b..f4fb6a9 100644 (file)
@@ -1018,10 +1018,15 @@ void tst_QToolBar::widgetAction()
     delete a;
 }
 
+#ifdef Q_OS_MAC
+QT_BEGIN_NAMESPACE
+extern void qt_set_sequence_auto_mnemonic(bool b);
+QT_END_NAMESPACE
+#endif
+
 void tst_QToolBar::accel()
 {
 #ifdef Q_OS_MAC
-    extern void qt_set_sequence_auto_mnemonic(bool b);
     qt_set_sequence_auto_mnemonic(true);
 #endif
     QMainWindow mw;