[Qt-interest] Comparing two QMetaObjects

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Mon Feb 7 16:07:03 CET 2011


On 2011-02-07 Thiago Thiago Macieira wrote:

>> ...
>> The comment from Thiago reminded me of a very crucial thing: EVERY 
>> object in the class hierarchy has to have the Q_OBJECT macro in their 
>> header/class declaration!
> 
> Well, the code compiles just fine without it.

... and that's exactly the danger of it ;)

> The question is whether 
> that missing Q_OBJECT was something you needed, like you mention:

Exactly. And it is very easy to forget in case your own class does not provide signals/slots itself, but you still expect it to work together with inherits() etc.

> http://labs.qt.nokia.com/2007/02/26/new-feature-compiler-errors/

*quicky rushes away and changes all his inherits() class to qobject_cast*

;)

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22





More information about the Qt-interest-old mailing list