Custom value types can be made known to the meta-object system by using the Q_DECLARE_METATYPE macro, which makes them storable in QVariant. Implicitly shared classes are both safe and efficient when passed as arguments, because only a pointer to the data is passed around, and the data is copied only if and when a function writes to it. Many of the Qt value types, such as QString and Qt Containers, also use implicit sharing (copy-on-write). The Meta-Object Compiler ( moc) will read the class definitions with the declared Q_OBJECT macro and produce the meta-object code.The Q_OBJECT macro is used to enable meta-object features when declared within a class definition.QObject is the base class that all objects in the meta-object system inherit from.
The meta-object system is implemented with a three-part mechanism: Signals and slots is one of the most important concepts in Qt, and it will be discussed in the next chapter. Qt's meta-object system provides the signals and slots mechanism for inter-object communication, run-time type information (RTTI), and the dynamic property system.