I wish to start an external process inside my gui application (QT v4.4.2, Win), the application can be suspended until the termination of that process. So far I used successfully the following code snippet:

Qt Code:
  1. QProcess process;
  2. process.start("something", args);
  3.  
  4. if (!process.waitForStarted()){
  5. // some error msg dialog
  6. return;
  7. }
  8.  
  9. if (!process.waitForFinished(-1))
  10. return;
To copy to clipboard, switch view to plain text mode 

Then I could read the the complete output/error channel of the terminated process. However I wish I could process the output channels line by line during the operation of the process, because I want to feed a progress bar. Therefore I replaced the waitForFinished block to something like that:

Qt Code:
  1. while (process.state()==QProcess::Running /* || process.waitForReadyRead(1) */){
  2. // reading process output channels
  3. }
To copy to clipboard, switch view to plain text mode 

My problem is that this while loop never ends, the process state always remains in Running state. How can I achieve my aim without asynchronous usage?