forked from qt-creator/qt-creator
QMakeProjectManager: Avoid using keys()
Instead, iterate directly over the container. Change-Id: I589e87b0ed86be778aec7679bedab28d709a7697 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -572,18 +572,15 @@ bool QmakePriFile::addFiles(const FilePaths &filePaths, FilePaths *notAdded)
|
|||||||
|
|
||||||
bool QmakePriFile::removeFiles(const FilePaths &filePaths, FilePaths *notRemoved)
|
bool QmakePriFile::removeFiles(const FilePaths &filePaths, FilePaths *notRemoved)
|
||||||
{
|
{
|
||||||
FilePaths failedFiles;
|
|
||||||
using TypeFileMap = QMap<QString, FilePaths>;
|
|
||||||
// Split into lists by file type and bulk-add them.
|
// Split into lists by file type and bulk-add them.
|
||||||
TypeFileMap typeFileMap;
|
QMap<QString, FilePaths> typeFileMap;
|
||||||
for (const FilePath &file : filePaths) {
|
for (const FilePath &file : filePaths) {
|
||||||
const MimeType mt = Utils::mimeTypeForFile(file);
|
const MimeType mt = Utils::mimeTypeForFile(file);
|
||||||
typeFileMap[mt.name()] << file;
|
typeFileMap[mt.name()] << file;
|
||||||
}
|
}
|
||||||
const QStringList types = typeFileMap.keys();
|
FilePaths failedFiles;
|
||||||
for (const QString &type : types) {
|
for (auto it = typeFileMap.cbegin(); it != typeFileMap.cend(); ++it) {
|
||||||
const FilePaths typeFiles = typeFileMap.value(type);
|
changeFiles(it.key(), *it, &failedFiles, RemoveFromProFile);
|
||||||
changeFiles(type, typeFiles, &failedFiles, RemoveFromProFile);
|
|
||||||
if (notRemoved)
|
if (notRemoved)
|
||||||
*notRemoved = failedFiles;
|
*notRemoved = failedFiles;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user