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

André Somers andre at familiesomers.nl
Mon Mar 7 21:26:01 CET 2016



Op 07/03/2016 om 21:21 schreef Curtis Mitch:
> Thanks guys.
>
> Is this worth mentioning in the documentation?
It already says so, right? I don't think it is needed to specify exactly 
what breaks.

André

>
> ________________________________________
> From: Development <development-bounces+mitch.curtis=theqtcompany.com at qt-project.org> on behalf of Giuseppe D'Angelo <giuseppe.dangelo at kdab.com>
> Sent: Monday, 7 March 2016 21:19
> To: development at qt-project.org
> Subject: Re: [Development] Usage of Q_OBJECT macro in QObject subclasses that don't use signals, slots, or properties
>
> 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
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list