How to use QTextStream readline one at the time, using timer
<p>I want to read a file one line at each second using timer. Once the timer is started, read the first line, after one second, read the second line......</p>

<p>But there is no function to read specific line in QTextStream. Any ideas on how to achieve this?</p>

<p>If I run the following code, it will always returns</p>

<blockquote>
<pre><code> QTextStream: no device
 QTextStream: no device
 QTextStream: no device
 QTextStream: no device
</code></pre>
</blockquote>

<pre><code>timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(sendmsg()));


void simulatorwindow::on_simON_clicked()
{ 
    simfile = QFileDialog::getOpenFileName(this, tr("Open"),"", tr("Files (*.txt)"));  
    QFile simfile(simfile);
    if (!simfile.open(QIODevice::ReadOnly | QIODevice::Text))
    return; 

    QTextStream textsim(&amp;simfile); 
    timer-&gt;start(1000);
    qDebug("Start simulation");
}

void simulatorwindow::on_simOFF_clicked()
{ 
    timer-&gt;stop();
    qDebug("Stop simulation");
}

void simulatorwindow::sendmsg()
{ 

    QString line = textsim.readLine();
    QString title = line.section(',', 0,0);
    QString chopped = line.section(',', 1,1);
}
</code></pre>
