[Interest] QtMacExtras don't work outside QtMacExtras
Sensei
senseiwa at gmail.com
Wed Apr 10 16:49:35 CEST 2013
Dear all,
after the new 5.0.2 update I was eager to give qt5 a try again, and see
if QtMacExtras wasn't a bad addition.
So I compiled and installed QtMacExtras, all went fine. I've tried from
the command line one example, the macunifiedtoolbar one, *from the
QtMacExtras directory*. It compiled and it run just fine. From the
command line.
Next, try to get the "application" widget example in qt5 use a native
toolbar. All I did is this, firing up the Qt Creator:
- in the .pro I wrote
QT += widgets macextras
- in the .h I forward-declared QtMacUnifiedToolBar and
#ifdef Q_OS_MAC
QtMacUnifiedToolBar *fileToolBar;
#else
QToolBar *fileToolBar;
#endif
- only one toolbar remains now, the fileToolBar
- in the source I added
#ifdef Q_OS_MAC
fileToolBar = new QtMacUnifiedToolBar(this);
#else
fileToolBar = addToolBar(tr("File"));
#endif
Now I've got TONS of errors, mainly because, as far as I understand,
there is a type mismatch in handling source files, treated as
Objective-C instead of Objective-C++:
In file included from
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8,
from
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:10,
from
../../../../include/QtMacExtras/qtmactoolbardelegate.h:45,
from ../../../../include/QtMacExtras/QtMacExtras:12,
from mainwindow.h:45,
from main.cpp:44:
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:409:
error: stray '@' in program
...
...
In file included from
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:69,
from
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:10,
from
../../../../include/QtMacExtras/qtmactoolbardelegate.h:45,
from ../../../../include/QtMacExtras/QtMacExtras:12,
from mainwindow.h:45,
from main.cpp:44:
/System/Library/Frameworks/Foundation.framework/Headers/NSTimer.h:8:
error: 'interface' does not name a type
/System/Library/Frameworks/Foundation.framework/Headers/NSTimer.h:11:
error: expected unqualified-id before '+' token
...
...
Not that from the command line changes something:
sensei:application% make
clang++ -c -pipe -mmacosx-version-min=10.6 -O2 -Wall -W -fPIE
-DQT_NO_DEBUG -DQT_MACEXTRAS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB
-DQT_CORE_LIB -I../../../../mkspecs/macx-clang -I. -I../../../../include
-I../../../../include/QtMacExtras
-I../../../../lib/QtMacExtras.framework/Versions/5/Headers
-I../../../../include/QtWidgets
-I../../../../lib/QtWidgets.framework/Versions/5/Headers
-I../../../../include/QtGui
-I../../../../lib/QtGui.framework/Versions/5/Headers
-I../../../../include/QtCore
-I../../../../lib/QtCore.framework/Versions/5/Headers -I.
-I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
-I/System/Library/Frameworks/AGL.framework/Headers -o main.o main.cpp
clang++ -c -pipe -mmacosx-version-min=10.6 -O2 -Wall -W -fPIE
-DQT_NO_DEBUG -DQT_MACEXTRAS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB
-DQT_CORE_LIB -I../../../../mkspecs/macx-clang -I. -I../../../../include
-I../../../../include/QtMacExtras
-I../../../../lib/QtMacExtras.framework/Versions/5/Headers
-I../../../../include/QtWidgets
-I../../../../lib/QtWidgets.framework/Versions/5/Headers
-I../../../../include/QtGui
-I../../../../lib/QtGui.framework/Versions/5/Headers
-I../../../../include/QtCore
-I../../../../lib/QtCore.framework/Versions/5/Headers -I.
-I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers
-I/System/Library/Frameworks/AGL.framework/Headers -o mainwindow.o
mainwindow.cpp
In file included from mainwindow.cpp:43:
In file included from ../../../../include/QtMacExtras/QtMacExtras:12:
In file included from
../../../../include/QtMacExtras/qtmactoolbardelegate.h:45:
In file included from
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:10:
In file included from
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:409:1:
error: expected unqualified-id
@class NSString, Protocol;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:417:50:
error: unknown type name 'Protocol'
FOUNDATION_EXPORT NSString *NSStringFromProtocol(Protocol *proto)
NS_AVAILABLE(10_5, 2_0);
^
...
...
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:19:10: error:
expected ';' after top level declarator
- (Class)class;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:19:10: error:
declaration of anonymous class must be a
definition
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [mainwindow.o] Error 1
Is anyone using this additional package on the mac? Any hints on why the
macextras example worked, while the Qt example doesn't? I don't know
what I am doing wrong here.
Thanks & Cheers!
More information about the Interest
mailing list