[Interest] Heavily Commented Example: Simple Single Frontend with Two BackendsLow,

Till Oliver Knoll till.oliver.knoll at gmail.com
Fri Oct 26 17:06:44 CEST 2012

2012/10/26 d3fault <d3faultdotxbe at gmail.com>:
> ...
> Weird, I thought all QObject derived classes required the Q_OBJECT
> macro. What are the exact requirements for this? Only if you use
> signals/slots in the derived class?

That. And if you make use of the Qt Meta Object system: qobject_cast,
QObject::inherits and the like.

Good practise is probably to *always" add Q_OBJECT to all
QObject-derived classes, because if you don't, chances are that you
simply forgot and qobject_cast fails in a subtle way: the result of
the cast will simply be "different" aka "wrong".

Cheers, Oliver

More information about the Interest mailing list