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:

Qt Code:
  1. for (start=0 ; start<numberOfFiles ; start++) // main Processing Loop
  2. { ...
  3. wait = true;
  4. while (wait)
  5. ; // Good For Nothing
  6. ...
  7. }
  8.  
  9. // Assume QPushButton clicked SIGNAL is properly linked to savedPressed() SLOT.
  10.  
  11. void BYDATE::savePressed () // SLOT
  12. wait=false;
  13. }
To copy to clipboard, switch view to plain text mode 

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