reading a file into Qt

I wrote a Program in Qt 5.2.1 that writes some data into a file and now I want to read it and display it. ( in a text edit or any other widget)

Here is my code ( the part I thought is relevant ) -

But i don't get the desires result ... could you look into it and tell me what i an doing wrong

void MainWindow::on_Search_clicked()
   QString name ;
   name = ui->Search_name->text();

   QFile readfile("data.txt");
       qDebug() << "error opening file: " << readfile.error();

   QTextStream instream(&readfile);
   QString line = instream.readLine();

   // ui->text is a QPlainTextEdit*



You should use

void QPlainTextEdit::appendPlainText ( const QString & text ) [slot]

method, link.

Need Your Help

Mix letters of a string in alphabetical order in matlab

string matlab sorting cell-array

I have the cell array of strings in matlab. I want to sort letters in every string in alphabetical order. How can I do that?

Filter resources by template variable value with MODx Wayfinder

modx modx-revolution wayfinder

I have a site that uses Wayfinder to display the latest 3 entries from an Articles blog. Now, I want to only consider those blog entries that are tagged Highlights.