Quantcast
Channel: What does the Q_OBJECT macro do? Why do all Qt objects need this macro? - Stack Overflow
Browsing latest articles
Browse All 7 View Live

Answer by Arne for What does the Q_OBJECT macro do? Why do all Qt objects...

In gcc with -E you can see expanded macros. This is what Q_OBJECT expands into on gcc on Linux. Be aware, this might be platform dependent and it might change depending on the version of QT. You can...

View Article



Answer by Bob Zhang for What does the Q_OBJECT macro do? Why do all Qt...

1 From Qt documentation of The Meta-Object SystemThe moc tool reads a C++ source file. If it finds one or more class declarations that contain the Q_OBJECT macro, it produces another C++ source file...

View Article

Answer by Andres for What does the Q_OBJECT macro do? Why do all Qt objects...

The Q_OBJECT macro must appear in the private section of a class definition that declares its own signals and slots or that uses other services provided by Qt's meta-object system.

View Article

Answer by aditya for What does the Q_OBJECT macro do? Why do all Qt objects...

The MOC (meta object compiler) converts the Q_OBJECT macro included header files in to C++ equivalent source code.It basically controls the signal-slot mechanism, and makes it understandable to the C++...

View Article

Answer by Martin Beckett for What does the Q_OBJECT macro do? Why do all Qt...

It simply tells the pre-compiler that this class needs to be run through the 'moc', or Meta-Object Compiler, which adds extra hidden fields and functions to the class as well as parsing signals and...

View Article


Answer by Stu Mackellar for What does the Q_OBJECT macro do? Why do all Qt...

From the Qt documentation:The Meta-Object Compiler, moc, is the program that handles Qt's C++ extensions.The moc tool reads a C++ header file. If it finds one or more class declarations that contain...

View Article

What does the Q_OBJECT macro do? Why do all Qt objects need this macro?

I just started using Qt and noticed that all the example class definitions have the macro Q_OBJECT as the first line. What is the purpose of this preprocessor macro?

View Article
Browsing latest articles
Browse All 7 View Live




Latest Images