forked from qt-creator/qt-creator
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: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -411,19 +411,20 @@ QString correspondingHeaderOrSource(const QString &fileName, bool *wasHeader)
|
|||||||
currentProject);
|
currentProject);
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
return path;
|
return path;
|
||||||
}
|
|
||||||
|
|
||||||
// Find files in other projects
|
// Find files in other projects
|
||||||
CppModelManager *modelManager = CppModelManager::instance();
|
} else {
|
||||||
QList<CppModelManagerInterface::ProjectInfo> projectInfos = modelManager->projectInfos();
|
CppModelManager *modelManager = CppModelManager::instance();
|
||||||
foreach (const CppModelManagerInterface::ProjectInfo &projectInfo, projectInfos) {
|
QList<CppModelManagerInterface::ProjectInfo> projectInfos = modelManager->projectInfos();
|
||||||
const ProjectExplorer::Project *project = projectInfo.project().data();
|
foreach (const CppModelManagerInterface::ProjectInfo &projectInfo, projectInfos) {
|
||||||
if (project == currentProject)
|
const ProjectExplorer::Project *project = projectInfo.project().data();
|
||||||
continue; // We have already checked the current project.
|
if (project == currentProject)
|
||||||
|
continue; // We have already checked the current project.
|
||||||
|
|
||||||
const QString path = correspondingHeaderOrSourceInProject(fi, candidateFileNames, project);
|
const QString path = correspondingHeaderOrSourceInProject(fi, candidateFileNames, project);
|
||||||
if (!path.isEmpty())
|
if (!path.isEmpty())
|
||||||
return path;
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
|
|||||||
Reference in New Issue
Block a user