I connected the ReadyRead-Signal from my SerialPort to the Slot

Qt Code:
  1. void Serial::handlePortReadyRead(){
  2. QByteArray temp = serialPort.readAll();
  3. qDebug()<<"Read from Port" << temp.toHex();
  4. emit ReadFromPort(temp);
  5. }
To copy to clipboard, switch view to plain text mode 

When I start a process I connect the ReadFromPort(QByteArray)-Signal to a Slot, where I handle the repsonse from the port.

Qt Code:
  1. void Process::analyzeFrame(QByteArray temp){
  2. for(int charCount = 0; charCount < temp.count(); charCount++){
  3. char singleInChar = temp.at(charCount);
  4. validationFlag = handleResponse(&response, deviceAddress, FID, singleInChar, false);
  5. break;
  6. }
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 

handleResponse returns 0 or 1. If it returns 1 I want the process to continue, 0 means I have to wait. If validationFlag does not get 1 within 100 msecs the process should stop.

Qt Code:
  1. serialPort.write(dataToSend);
  2. TimerForReadingFromPort->start(100);
  3. do{
  4. QApplication::processEvents();
  5. if(validationFlag == 1){
  6. //analyze response
  7. ...
  8. response.clear();
  9. }
  10. else if(TimerForReadingFromPort->remainingTime() == 0){
  11. ....
  12. return
  13. }
  14. }
  15. while(validationFlag == 0);//end while-Schleife
To copy to clipboard, switch view to plain text mode 

So this process is a very long process. Sometimes it get stucked in the middle of the code, I think it is because of the QApplication:rocessEvents().
Is there any better way?