ljshap
15th January 2009, 16:36
I want to iterate through a list of files and have the program wait until a user presses the skip or save push button before going to the next file. I created a boolean variable called wait which would be set to true and changed to false when a push button is pressed. The following is a code extract showing the logic:
for (start=0 ; start<numberOfFiles ; start++) // main Processing Loop
{ ...
wait = true;
while (wait)
; // Good For Nothing
...
}
// Assume QPushButton clicked SIGNAL is properly linked to savedPressed() SLOT.
void BYDATE::savePressed () // SLOT
wait=false;
}
The above code causes the program to hang. Is it possible to change the wait variable when the program is in the while loop. I'm hoping to avoid multi-threading, if possible. I tried getchar(), but that didn't work either.
Any suggestions?
Thanks
for (start=0 ; start<numberOfFiles ; start++) // main Processing Loop
{ ...
wait = true;
while (wait)
; // Good For Nothing
...
}
// Assume QPushButton clicked SIGNAL is properly linked to savedPressed() SLOT.
void BYDATE::savePressed () // SLOT
wait=false;
}
The above code causes the program to hang. Is it possible to change the wait variable when the program is in the while loop. I'm hoping to avoid multi-threading, if possible. I tried getchar(), but that didn't work either.
Any suggestions?
Thanks