private slots

Olivier Goffart ogoffart at kde.org
Thu Jan 4 18:26:06 GMT 2007


Le jeudi 4 janvier 2007 18:51, Simon Hausmann a écrit :
> On Thursday 04 January 2007 18:45, André Wöbbeking wrote:
> > On Thursday 04 January 2007 17:45, Simon Hausmann wrote:
> > > On Thursday 04 January 2007 17:24, André Wöbbeking wrote:
> > > > Can you still connect to private slots from "outside"? If so you
> > > > can call every private slot.
> > >
> > > Yes, that is correct.
> >
> > Why is that still possible? Couldn't it be disallowed in
> > QObject::connect()? Of course this should be done for protected slots
> > too.
>
> Sure could disallow it, but how do you detect when to allow it then? :)

line 2460 of qobject.cpp
in QObject::connect

QMetaMethod rmethod = rmeta->method(method_index);
if ( receiver != this  && rmethod.access() == Private)
	qWarning("cannot connect to a private slot");

but wait...  QObject::connect is static ...  so there is no this :-(
(but i'm sure this can be worked around.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070104/f6ee1d81/attachment.sig>


More information about the kde-core-devel mailing list