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 ...
Get Game Programming Using Qt now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.