Qthread and child thread communication between other thread
-
You can use signals and slots between worker threads as well.
-
@dheerendra
All three thread created by mainGUI thread.So can we connect between these workers thread ?
-
Hi,
Yes you can connect objects belonging to different threads.
-
-
You have one in QThread's documentation.
-
You have one in QThread's documentation.
I saw the example the thread created in the same class that going to be signal/slot used.
Here the all three thread created in mainGUI inthat case how can I connect between these worker thread (signal/slot) or do I need to connectted only from mainGUI thread as broker ?
I didnt see an example that same scenario as above?
Best -
I saw the example the thread created in the same class that going to be signal/slot used.
Here the all three thread created in mainGUI inthat case how can I connect between these worker thread (signal/slot) or do I need to connectted only from mainGUI thread as broker ?
I didnt see an example that same scenario as above?
Bestcam_01_thread = new QThread; cam_01 = new Camera01; cam_01->moveToThread(cam_01_thread); cam_02_thread = new QThread; cam_02 = new Camera_02; cam_02->moveToThread(cam_02_thread); frameProcess_thread = new QThread; process = new Camera_03; process->moveToThread(frameProcess_thread); connect(cam_01, &Camera01::signal, cam_02, Camera_02::slot, Qt::QueuedConnection);
-
I saw the example the thread created in the same class that going to be signal/slot used.
Here the all three thread created in mainGUI inthat case how can I connect between these worker thread (signal/slot) or do I need to connectted only from mainGUI thread as broker ?
I didnt see an example that same scenario as above?
Best@RahibeMeryem
nothing changes, really.make your connect inside the main Thread - where you create the different threads & workes - because that class has acess the all your instances.
connect singal from worker 1 to slot of worker 2 and do the connect inside the main class/thread
jsulm was a bit faster ;-)
don't forget to subsditute signal and slot with actual signals&slots of your classes.
-
cant believe so simple..
need to refresh my coffee.
thanks a lot all dear friends.