Problem with printing Details in txt File
-
hi in consol every thing in txt will be shown.
now i want to show in textBrowser but will show me nothing
@void MainWindow::on_pushButton_clicked()
{
QFile times("e:\time.txt");
times.open(QIODevice::ReadOnly);
QTextStream MyStream(×);
QString MyLine;do { MyLine = MyStream.readLine(); ui->textBrowser->setText(MyLine); } while(!MyLine.isNull()); }
@
What must i do? -
Hi,
@ui->textBrowser->setText(MyLine);@
You replace the content of textBrowser at each iteration.
On a side note, you don't check that the file opened successfully which is bad idea since it might not be found.
Also with Qt you can use the unix notation on all platform i.e.
@QFile times("e:/time.txt")@