Signal and slot question

Hi all,

I was looking at the Writing a GUI documentation (Chapter 25) and I have the following quetion based on the following lines given in such doc:

As I can see, the processor emits two parameters based on the Emit() definition
void TQObject::Emit(const char*, Long_t*)

One things is not clear to me is the connect call. Would the parameter values emitted by the function Evaluated(Float_t,Float_t) be the parameters values used by TH1F::Fill(Axis_t x,Axis_t y) ???

I notice those parameters are not of the same type: Float_t vs. Axis_t
is it possible to emit parameters so the receiving function uses them, specially in the case that the emitting function and receiving function are different objects?

Example:

Thank you,

Hi Christian,

Exactly! This is why the argument list must match the method parameters. In this case: (Axis_t, Axis_t)

Well, they are not exactly the same, but related types. Looking at RTypes.h:

typedef double         Axis_t;      //Axis values type (double)

Sure! This is the exact goal of the signal/slot mechanism: To be able to connect unrelated classes & methods. And obviously, the parameters of the emitted signals are used by the slot methods!

Note there is a typo in your examples (args[1] instead of args[0]). It should be:

Long_t args[2]; 
args[0]=(Long_t)processor->GetValue(1); 
args[1]=(Long_t)processor->GetValue(2); 
... 
processor->Emit(“Evaluated(Float_t,Float_t)”,args); 

You can also look at the ROOT GUI source code itself, signals/slots are used a bit everywhere!

Cheers, Bertrand.