O'Reilly logo

Game Programming Using Qt by Lorenz Haas, Witold Wysota

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Qt meta-objects

Most of the special functionality that Qt offers revolves around the QObject class and the meta-object paradigm that we will take a closer look at now. The paradigm says that with every QObject subclass, there is a special object associated that contains information about that class. It allows us to make runtime queries to learn useful things about the class—the class name, superclass, constructors, methods, fields, enumerations, and so on. The meta-object is generated for the class at compile time when three conditions are met:

  • The class is a descendant of QObject
  • It contains a special Q_OBJECT macro in a private section of its definition
  • Code of the class is preprocessed by a special Meta-Object Compiler (moc) tool

We can comply ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required