Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to connect using const char* method?



  • This post is deleted!


  • @CJha said in How to connect using const char* method?:

    Since the receiving object has no idea of the emitting object, I am trying to send my slot from receiving object to emitting object to be connected to its signal.

    You really are not supposed to do anything like this. Signallers should not need to know anything about slotters. The usual paradigm is to have somewhere in your code which knows about both the signaller and the slot(s) and do the connect() there.



  • @JonB I understand the usual paradigm, but my code is made in such a way so that the sender object is hidden, and so there is not really any place where header files from both sender and receiver are included simultaneously. This is to maintain modularity in the code.

    However, by using:

    connect(this, SIGNAL(testConnection()), receiver, method);
    

    in the sender it recognizes that I am trying to connect to Receiver::testConnection() and it has the pointer to the receiver passed to it, then in theory it should be capable of connecting its signal to the receiver's slot with only this much information about the receiver.