[Development] Usage of Q_OBJECT macro in QObject subclasses that don't use signals, slots, or properties

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Mon Mar 7 21:19:19 CET 2016


Il 07/03/2016 20:55, Curtis Mitch ha scritto:
> Why is this the case? What strange behaviour could result from not doing so?

qobject_cast breaks; the meta object system reports and uses the wrong 
class name (so things like "inherits", "className" etc. don't work); 
tr() uses the wrong context; and so on.

qobject_cast breakage may be serious enough to justify an automatic -1 
to all public QObjects-without-Q_OBJECT classes.

Cheers,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - The Qt Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4068 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160307/b5019926/attachment.bin>


More information about the Development mailing list