Reputation: 75
I would like to save in a .txt two lineEdit but in different line. It is together on the same line.
if(sFile.open(QFile::WriteOnly | QFile::Text))
{
QTextStream out(&sFile);
out << ui.lineEdit_2->text();
out << ui.lineEdit->text();
sFile.flush();
sFile.close();
}
PD: The text I'm putting in Qt Designer with LineEdit.
Upvotes: 1
Views: 170
Reputation: 12600
You can use endl
or "\n"
(n for "new line"). This is not Qt specific, but C++ in general:
out << ui.lineEdit_2->text() << "\n"
<< ui.lineEdit->text();
Upvotes: 4