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:
Nikolai Kosjar
2014-07-15 10:48:36 +02:00
parent 359bc13ea0
commit 4e9d3b044e

View File

@@ -411,9 +411,9 @@ QString correspondingHeaderOrSource(const QString &fileName, bool *wasHeader)
currentProject);
if (!path.isEmpty())
return path;
}
// Find files in other projects
} else {
CppModelManager *modelManager = CppModelManager::instance();
QList<CppModelManagerInterface::ProjectInfo> projectInfos = modelManager->projectInfos();
foreach (const CppModelManagerInterface::ProjectInfo &projectInfo, projectInfos) {
@@ -425,6 +425,7 @@ QString correspondingHeaderOrSource(const QString &fileName, bool *wasHeader)
if (!path.isEmpty())
return path;
}
}
return QString();
}