A New Krazy Checker for Classes Requiring Q_OBJECT

Thiago Macieira thiago at kde.org
Fri May 11 10:46:35 BST 2007


Tom Albers said:
> At Friday 11 May 2007 01:05, you wrote:
>> Tonight's Krazy run will start looking for QObject derived classes
>> that are without the Q_OBJECT macro.  This new checker was written
>> by  Thorsten Roeder.
>
> I thought that was only needed when there are signals or slots?
>
> Toma

The test only checks direct derivation from QObject. If you don't need any
of the Meta Object features (properties, signals, slots, enums, className,
qobject_cast, the meta object itself, etc.) why are you deriving from
QObject in the first place? :-)

QObjects are heavy: if you don't need any of those features, you shouldn't
derive from it.

Arguably, there might be a reason to derive in the QObject hierarchy
without including a Q_OBJECT macro, for instance to access a protected
member function, etc. But I don't believe it exists for direct QObject
derivation.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358






More information about the kde-core-devel mailing list