Qt-UI

MOC with C Make

MOC | | MOC CMake Example

Preliminarties:

Any class that emits or receives a signal needs to contain a MetaCallObject by placing the Q_OBJECT keyword as the first token of the class definition.

Then the MOC parser will inject a MetaCallObject into the class definition.

MOC is not a master-piece of software-engineering:

  • Q_OBJECT class definitions cannot be header-only.
  • Multiple class definitions in one header are not allowed.

CMake has a convenience helper to filter headers thorugh MOC:

QT4_WRAP_CPP(OUTFILES *.h)

The output files need to be treated as additional modules.

MOC | | MOC CMake Example

Options: