From 7b32c474949809a0b4cae2837700d81474119afa Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 9 Jan 2024 00:15:38 +0100 Subject: [PATCH] QMakeProjectManager: Avoid using keys() Instead, iterate directly over the container. Change-Id: I589e87b0ed86be778aec7679bedab28d709a7697 Reviewed-by: Christian Kandeler --- src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp index b5dd7bb037d..d29ad213ad8 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp @@ -572,18 +572,15 @@ bool QmakePriFile::addFiles(const FilePaths &filePaths, FilePaths *notAdded) bool QmakePriFile::removeFiles(const FilePaths &filePaths, FilePaths *notRemoved) { - FilePaths failedFiles; - using TypeFileMap = QMap; // Split into lists by file type and bulk-add them. - TypeFileMap typeFileMap; + QMap typeFileMap; for (const FilePath &file : filePaths) { const MimeType mt = Utils::mimeTypeForFile(file); typeFileMap[mt.name()] << file; } - const QStringList types = typeFileMap.keys(); - for (const QString &type : types) { - const FilePaths typeFiles = typeFileMap.value(type); - changeFiles(type, typeFiles, &failedFiles, RemoveFromProFile); + FilePaths failedFiles; + for (auto it = typeFileMap.cbegin(); it != typeFileMap.cend(); ++it) { + changeFiles(it.key(), *it, &failedFiles, RemoveFromProFile); if (notRemoved) *notRemoved = failedFiles; }