Hi all I have been trying to write to a text file. The code i currently have is:

Qt Code:
  1. QString savelocation = ui->ComboBox->text();
  2. QFile ffile(savelocation + "/" + ui->lineEdit->text() + ".txt");
  3. if (ffile.open(QFile::WriteOnly)) {
  4. QTextStream out(&ffile);
  5. out << ui->textEdit->toPlainText();
  6. }
To copy to clipboard, switch view to plain text mode 


The data is being written to the file fine. However there are no return characters between the lines;
e.g. if my text edit held:

Qt Code:
  1. The Quick brown
  2. Fox jumped over
  3. The lazy dog
To copy to clipboard, switch view to plain text mode 

it would be written to the file like this:

Qt Code:
  1. The Quick brown Fox jumped over The lazy dog
To copy to clipboard, switch view to plain text mode 

How do i solve this problem

Thanks for your time and trouble