Unsolved Send Var to Main thread
-
Hi
How can I send Variable or data from worker Thread (or other Thread implementation ) to Gui (Main Thread)?
I do vice versa (Gui Thread to other thread ) with signal/slot. -
@Alexanov
Thats exactly the way to do it:signals: void sendData(QVariant value); ... slots: void getData(QVariant value); //connect the 2 connect(ObjectInThread1, &myThreadedClass1::sendData, ObjectInThread2, &mainThreadClass::getData, Qt::QueuedConnection);
the
with5th paramter is optional, but either leave it open akaQt::AutoConnection
or writeQt::QueuedConnection
-
@Alexanov There is no difference whether from main thread to other thread or from other thread to main thread.