[Qt-interest] signals and slots....revisited...
Arnold Krille
arnold at arnoldarts.de
Tue Mar 15 08:54:05 CET 2011
On Monday 14 March 2011 20:17:16 K. Frank wrote:
> On Mon, Mar 14, 2011 at 4:47 AM, Arnold Krille <arnold at arnoldarts.de> wrote:
> > On Sunday 13 March 2011 19:00:34 sarvesh saran wrote:
> >> this is what i know (correct me if i am wrong)
> >> 1. slots are like ordinary member functions.however they can be
> >> called via signals irrespective of their access specifier.
> > Yes, slots are ordinary function, no, 'calling' them from signals can not
> > invalidate access specifiers.
>
> I think that Sarvesh is right about signals bypassing the access
> specifiers of slots. From:
>
> http://doc.qt.nokia.com/latest/signalsandslots.html
>
> Since slots are normal member functions, they follow the normal C++
> rules when called directly. However, as slots, they can be invoked by
> any component, regardless of its access level, via a signal-slot
> connection. This means that a signal emitted from an instance of an
> arbitrary class can cause a private slot to be invoked in an instance
> of an unrelated class.
>
> (I've never actually tried using a private slot, though.)
I am under the impression that you can only connect to slots you "see", so
from the outside of the object, only the public slots can be used for
connections. But I might be wrong…
Have fun,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110315/0f36c400/attachment.bin
More information about the Qt-interest-old
mailing list