[Development] Adoption of virtual_hook()

jan-arve.saether at nokia.com jan-arve.saether at nokia.com
Wed Apr 11 22:50:53 CEST 2012


Sorry for top-posting....
Yes, I didn't intend to suggest to add the virtual_hook for all classes, but only for a selection of polymorphic ones. (Which classes should be up to the maintainers to decide IMO, since its the maintainer than can "harvest the fruits" of a bit more future-proof API whenever that is needed). 

The virtual_hook() in QAccessibleInterface is of course not needed *now* (since for Qt5 we've cleaned it up to not depend on it), but we might need it *later*.

We had to create QIconEngineV2 (and I seem to recall a third version (QIconEngineV3?)) in order to avoid BIC breakage in the Qt4 days. This could probably have been avoided with a virtual_hook (and it might have been that insight which led to the adoption of virtual_hook there). Yes, it should be cleaned up by making the proper virtual functions, but IMO the virtual_hook should remain and nobody should reimplement it (now).

--Jan- Arve Sæther
________________________________________
Fra: development-bounces+jan-arve.saether=nokia.com at qt-project.org [development-bounces+jan-arve.saether=nokia.com at qt-project.org] på vegne av Fernengel Harald (Nokia-MP/Berlin)
Sendt: 11. april 2012 15:42
To: development at qt-project.org
Emne: Re: [Development] Adoption of virtual_hook()

Hi,

On Apr 11, 2012, at 15:09 , ext Thiago Macieira wrote:

> For non-QObject classes which *already* have virtual tables, we should
> consider it. Fortunately, those classes are minority in Qt, we have very few
> of them.

grep'ing through the source code, we have several virtual_hooks in Qt:

QAccessibleInterface - is this still needed? We have QAccessible2 now that uses proper interfaces

QSqlResult - this is a good example of virtual_hook, we used it to add several new functions to the SQL drivers during the Qt 4 lifetime. However, it should now be cleaned up to use real virtual functions (task 25252 created).

QIconEngine - uses "AvailableSizesHook". Since this is in QtWidgets, I wonder whether it's worth cleaning up.

Harald
_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


More information about the Development mailing list