diff options
| author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-07-15 10:48:36 +0200 |
|---|---|---|
| committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-07-24 12:24:03 +0200 |
| commit | 4e9d3b044e996f45909797ba3a3a88b22967d62e (patch) | |
| tree | 5fdd45c048e2c6fad9a9513755fd7908b3cb1ded /src/plugins/cpptools/cpptoolsplugin.cpp | |
| parent | 359bc13ea0f45ba0362238720b35ad38c373baa7 (diff) | |
| download | qt-creator-4e9d3b044e996f45909797ba3a3a88b22967d62e.tar.gz | |
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>
Diffstat (limited to 'src/plugins/cpptools/cpptoolsplugin.cpp')
| -rw-r--r-- | src/plugins/cpptools/cpptoolsplugin.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 44179a1fb4..d3cb9514eb 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -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(); |
