This is the ROOT implementation of the Qt object communication mechanism (see also http://www.troll.no/qt/metaobjects.html)
Signals and slots are used for communication between objects. When an object has changed in some way that might be interesting for the outside world, it emits a signal to tell whoever is listening. All slots that are connected to this signal will be activated (called). It is even possible to connect a signal directly to another signal (this will emit the second signal immediately whenever the first is emitted.) There is no limitation on the number of slots that can be connected to a signal. The slots will be activated in the order they were connected to the signal. This mechanism allows objects to be easily reused, because the object that emits a signal does not need to know to which objects the signals are connected. Together, signals and slots make up a powerfull component programming mechanism.
Signals
Signal emitted when object is destroyed. This signal could be connected to some garbage-collector object.
virtual void ChangedBy(const char *method)
This signal is emitted when some important data members of the object were changed. method_name parameter can be used as an identifier of the modifier method.
virtual void Message(const char *msg)
General purpose message signal
Definition at line 48 of file TQObject.h.
TString TQObject::CompressName |
( |
const char * |
method_name | ) |
|
|
staticprotected |
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in the method signature.
If a null or empty string is passed in, an empty string is returned.
Example:
Option_t * , Int_t , Int_t)");
static TString CompressName(const char *method_name)
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in t...
returns the string "Draw(char*,char*,char*,int,int)".
Definition at line 100 of file TQObject.cxx.
Bool_t TQObject::Connect |
( |
const char * |
class_name, |
|
|
const char * |
signal, |
|
|
const char * |
cl, |
|
|
void * |
receiver, |
|
|
const char * |
slot |
|
) |
| |
|
static |
This method allows to make a connection from any object of the same class to a single slot.
Signal and slot string must have a form: "Draw(char*, Option_t* ,Int_t)" All blanks and "const" words will be removed,
cl != 0 - class name, it can be class with or without dictionary, e.g interpreted class. Example:
"TH2F", myHist, "Draw(Option_t*)");
2-D histogram with a float per channel (see TH1 documentation)}
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
cl == 0 - corresponds to function (interpereted or global) the name of the function is defined by the slot string, parameter receiver should be 0. Example:
Warning:
If receiver class not derived from TQObject and going to be deleted, disconnect all connections to this receiver. In case of class derived from TQObject it is done automatically.
Definition at line 793 of file TQObject.cxx.
Bool_t TQObject::Connect |
( |
TQObject * |
sender, |
|
|
const char * |
signal, |
|
|
const char * |
cl, |
|
|
void * |
receiver, |
|
|
const char * |
slot |
|
) |
| |
|
static |
Create connection between sender and receiver.
Signal and slot string must have a form: "Draw(char*, Option_t* ,Int_t)" All blanks and "const" words will be removed,
cl != 0 - class name, it can be class with or without dictionary, e.g interpreted class. Example:
"TH2F", myHist,"Draw(Option_t*)");
cl == 0 - corresponds to function (interpereted or global) the name of the function is defined by the slot string, parameter receiver should be 0. Example:
Warning: If receiver is class not derived from TQObject and going to be deleted, disconnect all connections to this receiver. In case of class derived from TQObject it is done automatically.
Definition at line 701 of file TQObject.cxx.
Bool_t TQObject::Disconnect |
( |
TQObject * |
sender, |
|
|
const char * |
signal = 0 , |
|
|
void * |
receiver = 0 , |
|
|
const char * |
slot = 0 |
|
) |
| |
|
static |
Disconnects signal in object sender from slot_method in object receiver.
For objects derived from TQObject signal-slot connection is removed when either of the objects involved are destroyed.
Disconnect() is typically used in three ways, as the following examples shows:
- Disconnect everything connected to an object's signals:
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
- Disconnect everything connected to a signal:
- Disconnect a specific receiver:
0 may be used as a wildcard in three of the four arguments, meaning "any signal", "any receiving object" or "any slot in the receiving object", respectively.
The sender has no default and may never be 0 (you cannot disconnect signals from more than one object).
If signal is 0, it disconnects receiver and slot_method from any signal. If not, only the specified signal is disconnected.
If receiver is 0, it disconnects anything connected to signal. If not, slots in objects other than receiver are not disconnected
If slot_method is 0, it disconnects anything that is connected to receiver. If not, only slots named slot_method will be disconnected, and all other slots are left alone. The slot_method must be 0 if receiver is left out, so you cannot disconnect a specifically-named slot on all objects.
Definition at line 958 of file TQObject.cxx.