PDA

View Full Version : Q_object



Mariane
6th February 2006, 19:54
What is the Q_OBJECT macro, please? I don't mean what's the code
corresponding to it, but what does it do?

Mariane

Codepoet
6th February 2006, 20:24
It defines some class members needed for reflection and other special Qt features provided by classes derived from QObject.

Everall
6th February 2006, 21:02
You have to put the Q_OBJECT macro in every class where you want to use signals and slots.
You can read more about it in the documentation : signals and slots.

Cheers

wysota
6th February 2006, 23:18
You have to put the Q_OBJECT macro in every class where you want to use signals and slots.

This is not exactly true. You can omit the macro if you derive from a class which had it defined and you don't introduce any new signals or slots. If any of these two conditions is not met, you have to use that macro.

Everall
7th February 2006, 09:55
@Wysota :Yes, you explained it in a better analytical way.

What do you think of the following ;) :

You have to put the Q_OBJECT macro in every class where you want to use your own signals and slots.

Cheers

Mariane
7th February 2006, 18:39
Thank you

Mariane