Important: Please read the Qt Code of Conduct -

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:


    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



  • Moderators

    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;


    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

  • Moderators

    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.

Log in to reply