Skip to content
Snippets Groups Projects
Commit 4e9d3b04 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

CppTools: Fix Switch Header/Source going to wrong file


Check only other projects if the current file is not part of any
project.

Task-number: QTCREATORBUG-12328
Change-Id: I7db65b26313a26773bbbf17e966abd668ea9a1a5
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 359bc13e
No related branches found
No related tags found
No related merge requests found
......@@ -411,19 +411,20 @@ QString correspondingHeaderOrSource(const QString &fileName, bool *wasHeader)
currentProject);
if (!path.isEmpty())
return path;
}
// Find files in other projects
CppModelManager *modelManager = CppModelManager::instance();
QList<CppModelManagerInterface::ProjectInfo> projectInfos = modelManager->projectInfos();
foreach (const CppModelManagerInterface::ProjectInfo &projectInfo, projectInfos) {
const ProjectExplorer::Project *project = projectInfo.project().data();
if (project == currentProject)
continue; // We have already checked the current project.
const QString path = correspondingHeaderOrSourceInProject(fi, candidateFileNames, project);
if (!path.isEmpty())
return path;
} else {
CppModelManager *modelManager = CppModelManager::instance();
QList<CppModelManagerInterface::ProjectInfo> projectInfos = modelManager->projectInfos();
foreach (const CppModelManagerInterface::ProjectInfo &projectInfo, projectInfos) {
const ProjectExplorer::Project *project = projectInfo.project().data();
if (project == currentProject)
continue; // We have already checked the current project.
const QString path = correspondingHeaderOrSourceInProject(fi, candidateFileNames, project);
if (!path.isEmpty())
return path;
}
}
return QString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment