qt: Replace Qt::endl to "\n"

To fix Qt 5.12 MinGW build error.
This commit is contained in:
Calcitem 2021-10-24 19:09:43 +08:00
parent 5504f9120d
commit ae5e403be1
No known key found for this signature in database
GPG Key ID: F67E4F8CB7B5EED2
2 changed files with 13 additions and 13 deletions

View File

@ -1551,23 +1551,23 @@ void Game::saveScore()
QTextStream textStream(&file);
textStream << QCoreApplication::applicationFilePath() << Qt::endl << Qt::endl;
textStream << QCoreApplication::applicationFilePath() << "\n" << "\n";
textStream << gameTest->getKey() << Qt::endl << Qt::endl;
textStream << gameTest->getKey() << "\n" << "\n";
if (isAiPlayer[WHITE]) {
textStream << "White:\tAI Player" << Qt::endl;
textStream << "White:\tAI Player" << "\n";
} else {
textStream << "White:\tHuman Player" << Qt::endl;
textStream << "White:\tHuman Player" << "\n";
}
if (isAiPlayer[BLACK]) {
textStream << "Black:\tAI Player" << Qt::endl;
textStream << "Black:\tAI Player" << "\n";
} else {
textStream << "Black:\tHuman Player" << Qt::endl;
textStream << "Black:\tHuman Player" << "\n";
}
textStream << "" << Qt::endl;
textStream << "" << "\n";
position.gamesPlayedCount = position.score[WHITE] + position.score[BLACK] + position.score_draw;
@ -1575,10 +1575,10 @@ void Game::saveScore()
goto out;
}
textStream << "Sum\t" + QString::number(position.gamesPlayedCount) << Qt::endl;
textStream << "White\t" + QString::number(position.score[WHITE]) + "\t" + QString::number(position.score[WHITE] * 10000 / position.gamesPlayedCount) << Qt::endl;
textStream << "Black\t" + QString::number(position.score[BLACK]) + "\t" + QString::number(position.score[BLACK] * 10000 / position.gamesPlayedCount) << Qt::endl;
textStream << "Draw\t" + QString::number(position.score_draw) + "\t" + QString::number(position.score_draw * 10000 / position.gamesPlayedCount) << Qt::endl;
textStream << "Sum\t" + QString::number(position.gamesPlayedCount) << "\n";
textStream << "White\t" + QString::number(position.score[WHITE]) + "\t" + QString::number(position.score[WHITE] * 10000 / position.gamesPlayedCount) << "\n";
textStream << "Black\t" + QString::number(position.score[BLACK]) + "\t" + QString::number(position.score[BLACK] * 10000 / position.gamesPlayedCount) << "\n";
textStream << "Draw\t" + QString::number(position.score_draw) + "\t" + QString::number(position.score_draw * 10000 / position.gamesPlayedCount) << "\n";
out:
file.flush();

View File

@ -517,7 +517,7 @@ void MillGameWindow::saveBook(const QString &path)
auto *strlist = qobject_cast<QStringListModel *>(ui.listView->model());
for (const QString &cmd : strlist->stringList()) {
textStream << cmd << Qt::endl;
textStream << cmd << "\n";
}
file.flush();
@ -743,7 +743,7 @@ void MillGameWindow::on_actionSave_S_triggered()
QTextStream textStream(&file);
auto *strlist = qobject_cast<QStringListModel *>(ui.listView->model());
for (const QString &cmd : strlist->stringList())
textStream << cmd << Qt::endl;
textStream << cmd << "\n";
file.flush();
}