HOME

TheInfoList



OR:

Meta Object System is a part of
Qt framework Qt ( pronounced "cute") is a cross-platform application development framework for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, An ...
core provided to support Qt extensions to C++ like signals/slots for inter-object communication, run-time type information, and the dynamic property system.


Architecture

The Meta object system consists of 3 things: QObject
class Class, Classes, or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used d ...
, Q_OBJECT macro and a tool called moc (Meta-Object
Compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
). QObject is the base class for all Qt classes, Q_OBJECT macro is used to enable meta-object features in classes and finally moc is a
preprocessor In computer science, a preprocessor (or precompiler) is a Computer program, program that processes its input data to produce output that is used as input in another program. The output is said to be a preprocessed form of the input data, which i ...
that changes Q_OBJECT macro instances to C++
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
to enable meta object system mechanism in the class in which it is used. Using the meta object system has brought some criticism. In Qt documentation, several reasons have been given for the use of the meta object system, including benefits of code generation, dynamism of GUIs, automatic binding to scripting languages, not adding limitations and also reasonable performance in signal/slot implementation with moc. There are some efforts to make Qt needless of a preprocessor. These efforts include re-implementing Qt moc using libclang.


References

{{Qt Qt (software)