[Qt-interest] Convert to signal and slot

William Gordon Rutherdale (rutherw) rutherw at cisco.com
Sat Jul 23 00:14:25 CEST 2011


> From: qt-interest-bounces+rutherw=cisco.com at qt.nokia.com [mailto:qt-interest-bounces+rutherw=cisco.com at qt.nokia.com] On Behalf Of Sajjad
> Sent: 22 July 2011 17:59
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Convert to signal and slot
>
> My target was to get them done all using the Qt's signal and slot and now 
> the conversion process is making me confused me as well. I have changed 
> all  the virtual functions of the observer class to signal and do not know 
> how to define the slot and who take care of the slot, the subject or the observer manager.

The slots are the handlers.  

In the parlance of the Design Patterns book, signals are the Notify() calls in the subject.  Slots are the corresponding methods in the observer.

connect() is how you attach a slot of a given observer to a signal of a given subject.

It sounds like you need to do it the other way around from what you did:  the slots should be the virtual methods in the observers.

-Will




More information about the Qt-interest-old mailing list