What is qmake?qmake is a utility that automates the generation of Makefiles.
Makefiles are used by the program make to build executable programs from source code; therefore qmake is a make-makefile tool, or makemake for short.
QMake does not call g++/gcc directly. Instead, qmake creates native make files on your current platform. Under linux it creates standard GNU make files, under windows it can generate visual studio make files, under Mac OS X it can generate XCode project files. You then invoke your native build system (either GNU make, or MS NMake, or xcodebuild or whatever), which will call your native compiler (g++/gcc or whatever).
What is moc? http://doc.qt.io/qt-4.8/moc.html
The Meta-Object Compiler, moc, is the program that handles Qt's C++ extensions.
The moc tool reads a C++ header file.
1>If it finds one or more class declarations that contain the Q_OBJECT macro, it produces a C++ source file containing the meta-object code for those classes.and
2>meta-object code is required for the signals and slots mechanism and
3>moc is required for run-time type information, and the dynamic property system.
Note:
The C++ source file generated by moc must be compiled and linked with the implementation of the class.
But,If you use qmake to create your makefiles, build rules will be included that call the moc when required, so you will not need to use the moc directly.
Qt's meta object system?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.
No comments:
Post a Comment