From f1dd878ac885b5e3368a1d34e248f81aeb838b7f Mon Sep 17 00:00:00 2001 From: Isabell Pflug Date: Mon, 29 May 2023 18:04:47 +0200 Subject: [PATCH] :bug: Replaced '\n' with Qt::endl and fixed duplicate highscore entry --- ThinkPink/mainwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ThinkPink/mainwindow.cpp b/ThinkPink/mainwindow.cpp index f29db76..99d0113 100644 --- a/ThinkPink/mainwindow.cpp +++ b/ThinkPink/mainwindow.cpp @@ -172,13 +172,15 @@ void MainWindow::processHighscore() { QTextStream hs(&highscoreCSV); for (auto key = highscore.keyValueBegin(); key != highscore.keyValueEnd(); key++){ - hs << key->first.first << ";" << key->first.second.toString(Qt::DateFormat::ISODate) << ";" << key->second << "\n"; + hs << key->first.first << ";" << key->first.second.toString(Qt::DateFormat::ISODate) << ";" << key->second << Qt::endl; } highscoreCSV.close(); + usleep(500); // paranoia } void MainWindow::readHighscore() { + highscore.clear(); QDir appdata = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); QFile highscoreCSV = QFile(appdata.filePath(csv_name)); if (!appdata.exists()) {