I have a gui
class and another class named guiThread
. The gui
class starts guiThread
as a thread that communicates with gui
with the help of signals and slots.
I have a slot in guiThread
named doAction()
and I have a signal which is send from gui
class to this slot.
So what I want to do in guiThread
is that I want to do a while loop that waits until the signal is sent from gui
to doAction()
slot and when it recieved the signal, the slot does some calculations.
I dont know how to do this while loop and I dont even know if what I want is possible. I would be appreciate it if somebody could help me.
You need to initialize a private boolean block=true
, then you wait for the signal by while(block);
. Whenever you receive the signal, you do your calculations in the corresponding slot, and update block=false
at the end of it. Thus, when the code returns to the while, it will pass to continue processing.