[Qt-interest] Q_CLASSINFO interface name and preprocessor

Will Rutherdale (rutherw) rutherw at cisco.com
Thu Jul 2 23:19:40 CEST 2009


Hi.

Is there any way to control the second parameter to Q_CLASSINFO() so
that it can be automatically varied by project?  For instance:

class MyTenThousandthAdaptor : public QdbusAbstractAdaptor
{
    Q_OBJECT
    Q_CLASSINFO( "D-Bus Interface", PROJECT_PREFIX "ten_thousandth" )

// ...
};

The point being that if I could somehow induce the moc compiler to
expand PROJECT_PREFIX into a string constant, then all code compiled in
the same way would magically come out as "com.foobolts.ten_thousandth"
one time, and "com.barbolts.ten_thousandth" another time.

I've tried it both through the preprocessor and through the moc
command-line, trying to push a definition through for PROJECT_PREFIX,
without success.

Most of the documentation indicates that macro expansion doesn't work
with the moc compiler, but I would like to find out from others if there
is any way to work this, before I give up.

Any help would be appreciated.

-Will




More information about the Qt-interest-old mailing list