[Qt-interest] Q_CLASSINFO macro expansion

z zoomer.gm at gmail.com
Sun Jan 24 09:04:42 CET 2010


2010/1/24 Thomas Fjellstrom <tfjellstrom at shaw.ca>:
> On Sat January 23 2010, Christian Dähn wrote:
>> Hi,
>>
>> I had the exactly same problem - the reason is, that the moc cannot
>>  handle defines inside Qt macros - the moc is a little bit "stupid" and
>>  doesn't really work like a preprocessor.
>>
>> The only way I got it working was to use simple C-functions which return
>>  the values of the defines - e.g. like this:
>>
>> #define APP_VERSION  "1.0.0."
>>
>> QString getVersion() { return APP_VERSION; }
>>
>> Q_CLASSINFO("Version", getVersion());
>
> If its an odd parsing issue, do you think:
>
> #define APP_VERSION() "1.0.0.0"
> Q_CLASSINFO("Version", APP_VERSION());
>
> would work?
>
>> ciao,
>> Chris
>>
>
>
> --
> Thomas Fjellstrom
> tfjellstrom at shaw.ca
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>

Neither of this variants works for me : in both cases i got Parse error at "("




More information about the Qt-interest-old mailing list