[Qt-interest] Status of XCode Integration
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Mar 17 12:01:11 CET 2010
Philippe wrote on Wednesday, March 17, 2010 11:32 AM:
> Wrong. Moc knows about custom defines!... as far as it find them
> (which is the case with the Visual Studo integration default
> behaviour).
Yes, that's what I thought, too. When you look at what the Qt VS AddIn (or Integration) does when it generates the custom build steps for a *.h to be moc'ed you'll see that it adds all the -DWIN32 -DDEBUG -DWhatever (as taken from the current VS project, from the "DEFINES settings") as arguments to moc.
In other words, if you have:
class Foo : public QObject {
Q_OBJECT
public:
Foo();
...
public slots:
#ifdef I_LOVE_MY_WINDOWS
void thisSlotIsOnlyAvailableOnWindows();
#elif STEVE_IS_GREAT
void thisSlotIsOnlyAvailableOnMac();
#else
void thisSlotIsAvailableEverywhereElse();
#end
And generate the moc'ed output with something like
moc.exe -DI_LOVE_MY_WINDOWS Foo.h -o moc_Foo.cpp
(give or take a few syntax errors)
then you'll get different output in moc_Foo.cpp than when you'd moc with -DSTEVE_IS_GREAT.
Off course whether that is good practise is an entirely different discussion ;)
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list