ROOT 6.12/07 Reference Guide |
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.
Signal emitted when object is destroyed. This signal could be connected to some garbage-collector object.
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.
General purpose message signal
Definition at line 49 of file TQObject.h.
Public Member Functions | |
TQObject () | |
TQObject Constructor. More... | |
virtual | ~TQObject () |
TQObject Destructor. More... | |
Bool_t | AreSignalsBlocked () const |
Bool_t | BlockSignals (Bool_t b) |
virtual void | ChangedBy (const char *method) |
void | CollectClassSignalLists (TList &list, TClass *cls) |
Collect class signal lists from class cls and all its base-classes. More... | |
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. More... | |
virtual void | Connected (const char *) |
virtual void | Destroyed () |
Bool_t | Disconnect (const char *signal=0, void *receiver=0, const char *slot=0) |
Disconnects signal of this object from slot of receiver. More... | |
virtual void | Disconnected (const char *) |
template<typename T > | |
void | Emit (const char *signal, const T &arg) |
Activate signal with single parameter. More... | |
void | Emit (const char *signal) |
Acitvate signal without args. More... | |
template<typename... T> | |
void | EmitVA (const char *signal_name, Int_t, const T &... params) |
Emit a signal with a varying number of arguments. More... | |
TList * | GetListOfClassSignals () const |
Returns pointer to list of signals of this class. More... | |
TList * | GetListOfConnections () const |
TList * | GetListOfSignals () const |
virtual Bool_t | HasConnection (const char *signal_name) const |
Return true if there is any object connected to this signal. More... | |
virtual void | HighPriority (const char *signal_name, const char *slot_name=0) |
virtual void | LowPriority (const char *signal_name, const char *slot_name=0) |
virtual void | Message (const char *msg) |
virtual Int_t | NumberOfConnections () const |
Return number of connections for this object. More... | |
virtual Int_t | NumberOfSignals () const |
Return number of signals for this object. More... | |
Static Public Member Functions | |
static Bool_t | AreAllSignalsBlocked () |
Returns true if all signals are blocked. More... | |
static Bool_t | BlockAllSignals (Bool_t b) |
Block or unblock all signals. Returns the previous block status. More... | |
static Bool_t | Connect (TQObject *sender, const char *signal, const char *receiver_class, void *receiver, const char *slot) |
Create connection between sender and receiver. More... | |
static Bool_t | Connect (const char *sender_class, const char *signal, const char *receiver_class, void *receiver, const char *slot) |
This method allows to make a connection from any object of the same class to a single slot. More... | |
static Bool_t | Disconnect (TQObject *sender, const char *signal=0, void *receiver=0, const char *slot=0) |
Disconnects signal in object sender from slot_method in object receiver. More... | |
static Bool_t | Disconnect (const char *class_name, const char *signal, void *receiver=0, const char *slot=0) |
Disconnects "class signal". More... | |
Protected Member Functions | |
virtual void * | GetSender () |
virtual const char * | GetSenderClassName () const |
Static Protected Member Functions | |
static Int_t | CheckConnectArgs (TQObject *sender, TClass *sender_class, const char *signal, TClass *receiver_class, const char *slot) |
Checking of consitency of sender/receiver methods/arguments. More... | |
static TString | CompressName (const char *method_name) |
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in the method signature. More... | |
static Bool_t | ConnectToClass (TQObject *sender, const char *signal, TClass *receiver_class, void *receiver, const char *slot) |
Create connection between sender and receiver. More... | |
static Bool_t | ConnectToClass (const char *sender_class, const char *signal, TClass *receiver_class, void *receiver, const char *slot) |
This method allows to make connection from any object of the same class to the receiver object. More... | |
Protected Attributes | |
TList * | fListOfConnections |
list of signals from this object More... | |
TList * | fListOfSignals |
Bool_t | fSignalsBlocked |
list of connections to this object More... | |
Static Protected Attributes | |
static Bool_t | fgAllSignalsBlocked = kFALSE |
flag used for suppression of signals More... | |
Private Member Functions | |
TQObject (const TQObject &tqo) | |
TQObject & | operator= (const TQObject &tqo) |
#include <TQObject.h>
|
private |
TQObject::TQObject | ( | ) |
TQObject Constructor.
Comment:
Definition at line 393 of file TQObject.cxx.
|
virtual |
TQObject Destructor.
Definition at line 404 of file TQObject.cxx.
|
static |
Returns true if all signals are blocked.
Definition at line 1047 of file TQObject.cxx.
|
inline |
Definition at line 92 of file TQObject.h.
Block or unblock all signals. Returns the previous block status.
Definition at line 1055 of file TQObject.cxx.
Definition at line 93 of file TQObject.h.
|
inlinevirtual |
Definition at line 199 of file TQObject.h.
|
staticprotected |
Checking of consitency of sender/receiver methods/arguments.
Returns -1 on error, otherwise number or arguments of signal function. Static method.
Definition at line 181 of file TQObject.cxx.
Collect class signal lists from class cls and all its base-classes.
The recursive traversal is not performed for classes not deriving from TQClass.
Definition at line 451 of file TQObject.cxx.
|
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:
returns the string "Draw(char*,char*,char*,int,int)".
Definition at line 100 of file TQObject.cxx.
Bool_t TQObject::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.
Warning! No check on consistency of sender/receiver classes/methods.
This method makes possible to have connection/signals from interpreted class. See also RQ_OBJECT.h.
Definition at line 867 of file TQObject.cxx.
|
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:
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.
|
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:
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.
|
inlinevirtual |
Definition at line 194 of file TQObject.h.
|
staticprotected |
Create connection between sender and receiver.
Receiver class needs to have a dictionary.
Definition at line 561 of file TQObject.cxx.
|
staticprotected |
This method allows to make connection from any object of the same class to the receiver object.
Receiver class needs to have a dictionary.
Definition at line 617 of file TQObject.cxx.
|
inlinevirtual |
Reimplemented in TQConnection.
Definition at line 197 of file TQObject.h.
Disconnects signal of this object from slot of receiver.
Equivalent to Disconnect(this, signal, receiver, slot)
Definition at line 1025 of file TQObject.cxx.
|
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:
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.
|
static |
Disconnects "class signal".
The class is defined by class_name. See also Connect(class_name,signal,receiver,slot).
Definition at line 1006 of file TQObject.cxx.
|
inlinevirtual |
Definition at line 195 of file TQObject.h.
|
inline |
Activate signal with single parameter.
Example:
If we call Emit with an array of the parameters, they should be converted to long type. Example:
Definition at line 165 of file TQObject.h.
|
inline |
Acitvate signal without args.
Example: theButton->Emit("Clicked()");
Definition at line 174 of file TQObject.h.
|
inline |
Emit a signal with a varying number of arguments.
Definition at line 101 of file TQObject.h.
TList * TQObject::GetListOfClassSignals | ( | ) | const |
Returns pointer to list of signals of this class.
Definition at line 435 of file TQObject.cxx.
|
inline |
Definition at line 90 of file TQObject.h.
|
inline |
Definition at line 89 of file TQObject.h.
|
inlineprotectedvirtual |
Reimplemented in TQObjSender, TGFrame, TProofPlayer, TBonjourBrowser, TBonjourRegistrar, TVirtualPad, TBonjourResolver, TMonitor, TMessageHandler, TGEventHandler, and TSysEvtHandler.
Definition at line 58 of file TQObject.h.
|
inlineprotectedvirtual |
Reimplemented in TQObjSender.
Definition at line 59 of file TQObject.h.
|
virtual |
Return true if there is any object connected to this signal.
Only checks for object signals.
Definition at line 525 of file TQObject.cxx.
|
virtual |
Definition at line 477 of file TQObject.cxx.
|
virtual |
Definition at line 503 of file TQObject.cxx.
|
inlinevirtual |
Reimplemented in TTreeViewer.
Definition at line 201 of file TQObject.h.
|
virtual |
Return number of connections for this object.
Definition at line 549 of file TQObject.cxx.
|
virtual |
Return number of signals for this object.
Only checks for object signals.
Definition at line 539 of file TQObject.cxx.
flag used for suppression of signals
Definition at line 56 of file TQObject.h.
|
protected |
list of signals from this object
Definition at line 53 of file TQObject.h.
|
protected |
Definition at line 52 of file TQObject.h.
|
protected |
list of connections to this object
Definition at line 54 of file TQObject.h.