Commit a1ae4aff authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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: default avatarhjk <hjk@qt.io>
parent 2b80f9b8
......@@ -555,13 +555,19 @@ QStringList Project::files(Project::FilesMode fileMode,
if (!rootProjectNode())
return result;
QSet<QString> 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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment