How to connect signal from one thread to Qwebsocket client class to send message?



  • I have one main thread for gui in which start and stop methods (slots) are there. As i execute the project and click start button in gui, then another thread get started and from that thread i am emitting a string signal to my EchoClient class where i am receiving that signal in a slot function and in that function i am sending that string data to server. The problem is that signal is emitting but not receiving in EchoClient slot. The syntax is-
    "connect(&mThread, &MainMotionThread::Send_Msg_Signal, this, &EchoClient::onRecieveDistanceGridX);"

    Where Send_Msg_Signal() is signal from MainMotion Thread-
    signals:
    void Send_Msg_Signal(QString data);

    and onRecieveDistanceGridX() is slot in EchoClient-
    public Q_SLOTS:
    void onRecieveDistanceGridX(QString data);

    Am I doing something wrong in making connection?? will appreciate any help.


  • Lifetime Qt Champion

    Hi,

    Can you share the complete code where you create your thread and do these connections ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.