I have a class that inherits from QThread
and that handles a ZeroMQ SUB
subscribe socket in a while loop ( polling in the thread's run method ) and notifies the GUI thread by emitting signals when receiving messages from the socket.
In this QThread
derived class, before the polling loop, I also create a ZeroMQ PUB
publish socket and there are methods to use it. These methods are only used in the main thread ( GUI ) to send data to the server.
This solution works without any problem, but it's not perfect. I want only one thread to handle both subscribe and publish sockets operations. The GUI thread ( main ) instead of calling a QThread
derived class method, will send a signal to request publishing a data.
Is there a nice pattern, based on Qt tools, to implement that ?