[Qt-interest] Q_CLASSINFO macro expansion

Christian Dähn daehn at asinteg.de
Sat Jan 23 22:18:28 CET 2010


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());

ciao,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100123/7e8b2f73/attachment.html 


More information about the Qt-interest-old mailing list