diff --git a/components/config/gamesettings.cpp b/components/config/gamesettings.cpp index c28edf1e93..bc2286fbfd 100644 --- a/components/config/gamesettings.cpp +++ b/components/config/gamesettings.cpp @@ -165,12 +165,10 @@ bool Config::GameSettings::readFile(QTextStream& stream, QMultiMap i(mUserSettings); - i.toBack(); - - while (i.hasPrevious()) + auto i = mUserSettings.end(); + while (i != mUserSettings.begin()) { - i.previous(); + i--; // path lines (e.g. 'data=...') need quotes and ampersands escaping to match how boost::filesystem::path uses // boost::io::quoted @@ -388,12 +386,10 @@ bool Config::GameSettings::writeFileWithComments(QFile& file) // Iterate in reverse order to preserve insertion order QString settingLine; - QMapIterator it(mUserSettings); - it.toBack(); - - while (it.hasPrevious()) + auto it = mUserSettings.end(); + while (it != mUserSettings.begin()) { - it.previous(); + it--; if (it.key() == QLatin1String("data") || it.key() == QLatin1String("data-local") || it.key() == QLatin1String("resources") || it.key() == QLatin1String("load-savegame")) diff --git a/components/config/launchersettings.cpp b/components/config/launchersettings.cpp index 0cea8270aa..02a5202857 100644 --- a/components/config/launchersettings.cpp +++ b/components/config/launchersettings.cpp @@ -50,12 +50,10 @@ bool Config::LauncherSettings::writeFile(QTextStream& stream) QRegularExpression sectionRe("^([^/]+)/(.+)$"); QMultiMap settings = SettingsBase::getSettings(); - QMapIterator i(settings); - i.toBack(); - - while (i.hasPrevious()) + auto i = settings.end(); + while (i != settings.begin()) { - i.previous(); + i--; QString prefix; QString key;