aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-11-18 10:31:16 +0100
committercon <qtc-committer@nokia.com>2009-11-19 18:32:11 +0100
commit18e8a8ce8841c32db50eab99c8b079337f50f699 (patch)
treee0ad1de4e78cff92243a9805039e9ee3555c2f8d
parent7c5853d2b362e07a722d76fe80ee6dc356ca427e (diff)
Designer: Restrict files used for "Go to slot" to project of ui-file.
Reviewed-by: con Task-number: QTCREATORBUG-245 (cherry picked from commit 213b8638ed1e13f513aca93c62f927fb9dc9fa50)
-rw-r--r--src/plugins/designer/qtcreatorintegration.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index 87a087caf3..bcef581f42 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -47,6 +47,8 @@
#include <extensionsystem/pluginmanager.h>
#include <texteditor/basetexteditor.h>
#include <texteditor/itexteditable.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/session.h>
#include <QtDesigner/QDesignerFormWindowInterface>
@@ -577,9 +579,22 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
const QFileInfo fi(currentUiFile);
const QString uicedName = QLatin1String("ui_") + fi.completeBaseName() + QLatin1String(".h");
+ // Retrieve code model snapshot restricted to project of ui file.
+ const ProjectExplorer::Project *uiProject = ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(currentUiFile);
+ if (!uiProject) {
+ *errorMessage = tr("Internal error: No project could be found for %1.").arg(currentUiFile);
+ return false;
+ }
+ CPlusPlus::Snapshot docTable = cppModelManagerInstance()->snapshot();
+ for (CPlusPlus::Snapshot::iterator it = docTable.begin(); it != docTable.end(); ) {
+ const ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::instance()->session()->projectForFile(it.key());
+ if (project == uiProject) {
+ ++it;
+ } else {
+ it = docTable.erase(it);
+ }
+ }
// take all docs, find the ones that include the ui_xx.h.
-
- const CPlusPlus::Snapshot docTable = cppModelManagerInstance()->snapshot();
QList<Document::Ptr> docList = findDocumentsIncluding(docTable, uicedName, true); // change to false when we know the absolute path to generated ui_<>.h file
if (Designer::Constants::Internal::debug)