April 8, 2011

michael michael
Lab Rat
5 posts

Preprocessor macro and Q_INVOKABLE

 

I need to declare Q_INVOKABLE method inside a preprocessor macro.
Is it possible? Looks like it does not work.

Thank you,
Michael

2 replies

April 8, 2011

Andre Andre
Area 51 Engineer
6067 posts

No, that is not possible. Q_INVOKABLE is processed by moc, which does not expand macros itself and is run before macros are expanded.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

April 8, 2011

ZapB ZapB
Robot Herder
1358 posts

The same is true for many other Q_* “macros”. They actually expand to nothing in the preprocessor. They are special keywords used by the meta-object compiler to indicate that it needs to generate some code there.

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

 
  ‹‹ Statlic linking of Qt and C++ libraries      Type casting in QtScript. ››

You must log in to post a reply. Not a member yet? Register here!