PDA

View Full Version : Passing data from worker thread to main GUI thread



Aham
26th November 2016, 16:16
I need to pass data from worker thread (that reads from a serial port) and then pass the data to main GUI thread which needs to display the data. How can I achieve this?

d_stranz
26th November 2016, 19:01
Use signals and slots or use a pointer to shared memory that you protect using a mutex. Reading the Qt documentation here (http://doc.qt.io/qt-5/ipc.html) and here (http://doc.qt.io/qt-5.7/thread-basics.html) would be a good place to start.