Proposing the removal of virtual_hooks (or how you can add a virtual method without using "virtual")

Thiago Macieira thiago at kde.org
Sat Mar 4 11:18:15 GMT 2006


I'd like to propose a change of policy in the KDE libraries: remove all 
virtual_hook functions from QObject-derived classes.

The reason for that is that we *already* have a virtual_hook function in 
those classes and it's called qt_metacall. It's automatically generated 
by moc, so we're safe that it'll always exist.

This policy is inspired in the "Using signals instead of virtual 
functions" section of 
http://developer.kde.org/documentation/other/binarycompatibility.html.

Given the use we've had of virtual_hooks in the KDE3 series and given that 
KDE4 is supposed to be more stable than before, I think this solution 
will be cleaner in the long run.

Also note that classes not deriving from QObject do not have this luxury. 
If you have a tree of classes that don't use QObject, you should either 
consider using it, if possible, or add virtual_hooks.
-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

4. And æfter se scieppend ingelogode, he wrát "cenn", ac eala! se 
rihtendgesamnung andswarode "cenn: ne wát hú cennan 'eall'. Ástynt."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060304/fd816478/attachment.sig>


More information about the kde-core-devel mailing list