Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Function Call from Signal Slot

    General and Desktop
    2
    4
    887
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      praveen0991kr last edited by

      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

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        You need to have the pointer to an object of that other class and pass it in place of "this".

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • P
          praveen0991kr last edited by

          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

          1 Reply Last reply Reply Quote 0
          • sierdzio
            sierdzio Moderators last edited by

            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.

            (Z(:^

            1 Reply Last reply Reply Quote 0
            • First post
              Last post