[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: signals and slots vs. virtual_hook (was [PATCH] KFileDialog
From: Matthias Kretz <kretz () kde ! org>
Date: 2008-07-15 17:02:28
Message-ID: 200807151902.29244.kretz () kde ! org
[Download RAW message or body]
On Tuesday 15 July 2008 18:42:05 Leo Savernik wrote:
> Am Dienstag, 15. Juli 2008 schrieb Thiago Macieira:
> > Besides, my point is exactly that qt_metacall *is* the same as
> > virtual_hook. There's no need to involve signals here. Technically all
> > you needed to do was:
> >
> > void MiddleClass::publicFunction(bool b)
> > {
> > void *args[] = { &b };
> > int id = metaObject()->indexOfMethod("privateFunction(bool)");
> > qt_metacall(QMetaObject::InvokeMetaMethod, id, args);
> > }
>
> Cool, I didn't know that! It's ugly, but it should still be faster than a
> slot invocation.
If you cache the index. Otherwise it's pretty much the same AFAIK.
> [Declaration]
>
> > protected:
> > Q_INVOKABLE void privateFunction(bool b);
> > };
>
> Say, I don't have a Q_INVOKABLE in release x. Is then adding Q_INVOKABLE in
> release x+1 BIC?
Yes, it doesn't change anything in the binary representation of the class. It
just tells moc that it should treat this function much like a slot - therefore
the qt_metacall will then work on it.
--
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homelinux.org/
MatthiasKretz@gmx.net, kretz@kde.org,
Matthias.Kretz@urz.uni-heidelberg.de
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic