1.

What Is Qt's Meta Object System?

Answer»

Qt's meta-object system provides the signals and slots mechanism for inter-object communication, run-time type INFORMATION, and the dynamic PROPERTY system.

The meta-object system is BASED on three things:

  1. The QObject class provides a base class for objects that can take advantage of the meta-object system.
  2. The Q_OBJECT macro inside the private section of the class declaration is used to enable meta-object features, such as dynamic properties, signals, and slots.
  3. The Meta-Object Compiler (moc) supplies each QObject subclass with the necessary code to implement meta-object features.

The moc tool reads a C++ source FILE. If it finds one or more class declarations that contain the Q_OBJECTmacro, it produces another C++ source file which CONTAINS the meta-object code for each of those classes.

Qt's meta-object system provides the signals and slots mechanism for inter-object communication, run-time type information, and the dynamic property system.

The meta-object system is based on three things:

The moc tool reads a C++ source file. If it finds one or more class declarations that contain the Q_OBJECTmacro, it produces another C++ source file which contains the meta-object code for each of those classes.



Discussion

No Comment Found