Use QTextStream for reading the file not only for giving the wrong read text out!

Edit: From the QFile documentation
Qt Code:
  1. QFile file("in.txt");
  2. if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
  3. return;
  4.  
  5. QTextStream in(&file);
  6. while (!in.atEnd()) {
  7. QString line = in.readLine();
  8. process_line(line);
  9. }
To copy to clipboard, switch view to plain text mode