title: QSerialPort proper sending of many lines
body: <p>I am trying to write really big files to serialport using QSerialPort (QT 5.3.1). The problem is - I keep sending more than device can handle. 
  Programm works like this (this function is called once in 50ms):</p>
  
  <pre><code>void MainWindow::sendNext()
  {
      if(sending &amp;&amp; !paused &amp;&amp; port.isWritable())
      {
          if(currentLine &gt;= gcode.size()) //check if we are at the end of array
          {
              sending = false;
              currentLine = 0;
              ui-&gt;sendBtn-&gt;setText("Send");
              ui-&gt;pauseBtn-&gt;setDisabled("true");
              return;
          }
          if(sendLine(gcode.at(currentLine))) currentLine++; //check if this was written to a serial port
          ui-&gt;filelines-&gt;setText(QString::number(gcode.size()) + QString("/") + QString::number(currentLine) + QString(" Lines"));
          ui-&gt;progressBar-&gt;setValue(((float)currentLine/gcode.size()) * 100);
      }
  }
  </code></pre>
  
  <p>But it eventually gets flawed and hangs (on the device, not on the PC). If only I could check somehow if the device is ready or not for next line, but I cant find anything like it in the QSerial docs. 
  Any ideas?</p>