From a1ae4affc2a2f47309ee78b2e0b90c62c79cc300 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 20 Apr 2017 14:49:10 +0200 Subject: [PATCH] Project: Remove duplicates from file list Remove duplicate entries from list of project files. The duplicate entries used to be visible in e.g. the locator. Change-Id: I4a58ff11bd37ff39f4c9186ae89a2d384894bc1e Reviewed-by: hjk --- src/plugins/projectexplorer/project.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index bb62390fe40..cd8e435f455 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -555,13 +555,19 @@ QStringList Project::files(Project::FilesMode fileMode, if (!rootProjectNode()) return result; + QSet alreadySeen; rootProjectNode()->forEachNode([&](const FileNode *fn) { if (filter && !filter(fn)) return; + const QString path = fn->filePath().toString(); + const int count = alreadySeen.count(); + alreadySeen.insert(path); + if (count == alreadySeen.count()) + return; // skip duplicates if ((fileMode == AllFiles) || (fileMode == SourceFiles && !fn->isGenerated()) || (fileMode == GeneratedFiles && fn->isGenerated())) - result.append(fn->filePath().toString()); + result.append(path); }); return result; }