Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Function Call from Signal Slot
Forum Updated to NodeBB v4.3 + New Features

Function Call from Signal Slot

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k Views 1 Watching
  • 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 Offline
    P Offline
    praveen0991kr
    wrote on last edited by
    #1

    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
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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
      0
      • P Offline
        P Offline
        praveen0991kr
        wrote on last edited by
        #3

        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
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          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
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved