[Qt-interest] signals and slots....revisited...

K. Frank kfrank29.c at gmail.com
Mon Mar 14 20:17:16 CET 2011


Hello Arnold and Sarvesh!

On Mon, Mar 14, 2011 at 4:47 AM, Arnold Krille <arnold at arnoldarts.de> wrote:
> Hi,
> 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.)

> ...
>
> Arnold

Best regards.


K. Frank



More information about the Qt-interest-old mailing list