Function Call from Signal Slot
-
Dear All,
I am trying to access one fuction that I have defined in class let Say "Class A"
and trying to call from "class B" from signal slot ;
@
I am able to connect with in the Class A;
like wise:
connect(ui->UpdatScr,SIGNAL(selectionChanged()),this,SLOT(OpenKeypad()));@
But how to connect :
@
from Class A;
from connect(ui->updtScr,SIGNAL(selectionChanged()),"To-other-classB",SLOT(Class-B-function-Name))); ???
@
Pls Provide some sample from code if possible I will be very thankful to you;
Thank You
Regards
Praveen
-
You need to have the pointer to an object of that other class and pass it in place of "this".
-
Hi ,
Thanks for reply ;What I have tried;
in .h file;
@
Keypad *mKeypad;
@in .c file;
@
connect(ui->UpdatScr,SIGNAL(selectionChanged()),,myKeyPad,SLOT(OpenKeypad(1,1,1,1,1);));
@OpenKeypad(int,int,int,int,int) is fuction defined in Keypad class;
but it didnt worked Is I am make any mistake;
Thanks for reply
-
You need to instantiate the object using "new". I recommend reading a book on C++ or Qt before proceeding further, it will make it easier for you.