signal & slot

  • Is it possible to connect signal and slot of two different classes from a 3rd class?

  • @Ripon-Azad Yes, one of the important features of Qt's signal/slot mechanism is that the sender and receiver don't have to know anything about each other or about the connection between them. You just have to use one of the static QObject::connect functions if you don't do it in the receiver object.

  • @Eeli-K thanks for replaying. but I am having a problem.. for example:
    signal a;

    slot b;
    now I am in
    how can I connect signal a and slot b here? I mean QObject::connect(..............) about this line.

  • @Ripon-Azad You have to able to reach the object of type classA and the object of type classB in a method of classC. They can be given as arguments to the method or be members of classC, or whatever makes them available. Then just use one of the static QObject::connect functions and give the sender object, signal, receiver object and and slot as arguments. For details and examples read, it a must-read anyways because it's so central in using Qt. Try something first and ask specific questions if need arises.

  • @Eeli-K thank you so much. Although I read it already but I will look it again.

Log in to reply