[Development] Virtual hook in qobject?

Allan Sandfeld Jensen kde at carewolf.com
Fri Sep 11 13:34:16 CEST 2020


On Freitag, 11. September 2020 12:44:09 CEST Volker Hilsheimer wrote:
> > On 11 Sep 2020, at 12:37, Allan Sandfeld Jensen <kde at carewolf.com> wrote:
> > 
> > Should we add a generic virtual hook in qobject, so any qobject can expand
> > 
 their with effectively virtual functions in Qt6?
> > 
> > I imagine something like QVariant QObject::virtual_hook(int id, QVariant 
> > args);
> > 
> > Or do we already have other useful work-arounds for this common problem?
> > 
> > Best regards
> > ‘Allan
> 
> 
> We have that already. It’s called qt_metacall :)
> 
Right :) but that typically gets generated by moc, but I see what you mean. 
You can manually implement it, or get a similar effect through careful use of 
INVOKABLE and an indirection.

And the two places I was thinking about cleaning up also turned out to be non-
QObject.

Best regards
Allan




More information about the Development mailing list