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,

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

  • 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.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.