<div dir="ltr"><div dir="ltr"><div class="gmail-content"><p>Hello,</p>
<p>I'm trying to implement a serial connection with QIODevice 
(SerialPort). I would like to parse line by line (each line consists of 
multiple columns of data) and for this I found canReadLine().<br>
But as I understand I have to use startTransaction, because otherwise the buffer will not be used. I'm I correct?</p>
<pre class="gmail-markdown-highlight"><code class="gmail-hljs gmail-php">bool QIODevice::canReadLine() <span class="gmail-hljs-keyword">const</span>
{
    Q_D(<span class="gmail-hljs-keyword">const</span> QIODevice);
    <span class="gmail-hljs-keyword">return</span> d->buffer.indexOf(<span class="gmail-hljs-string">'\n'</span>, d->buffer.size(),
                             d->isSequential() ? d->transactionPos : Q_INT64_C(<span class="gmail-hljs-number">0</span>)) >= <span class="gmail-hljs-number">0</span>;
}
</code></pre>
<p>So to read a full line, I have to open a QSerialPort and then start a
 Transaction. Then I have to wait a little bit (till data is in the 
buffer) and then I can use canReadLine. Am I correct? Is there a better 
way instead to wait a little bit? Or is it the wrong way to go?</p><p><br></p><p>Best regards,</p><p>Martin</p></div></div></div>