![]() |
![]() |
|
Alia | Widgets |
Alia's signals and slots are an implementation of the Observer Design Pattern. The signals and slots mechanism allows objects to be notified of events in other objects, without the observed object having to know anything about the observing objects. This allows objects to communicate with each other, without any tight coupling.
A SIGNAL is EMITTED from an object whenever a specific event occurs within the object. Other objects may CONNECT to that specific SIGNAL if they wish. When an object connects to a signal of another object, it must specify a SLOT method for the emitted signal to be sent to. This slot method will be called each time the signal it is connected to is emitted.
An example of the signals and slots mechanism can be found in the simple ALoginWidget widget. (ALoginWidget is a simple widget that allows a user to enter a user name an a password) If I am writing a program and I want to use the ALoginWidget in my program, I need to know when the user fills out the form and hits the submit button, so that my application can log them into the system. ALoginWidget emits a signal called 'loginPushed' when the user clicks the submit button. All my application has to do, is connect a slot to the 'loginPushed' signal.
![]() |
![]() |
|
Alia | Widgets |
Documentation generated on Fri, 11 Jul 2008 13:28:37 -0400 by phpDocumentor 1.4.2