diff options
author | Marco Benelli <marco.benelli@qt.io> | 2018-05-08 13:40:45 +0200 |
---|---|---|
committer | Marco Benelli <marco.benelli@qt.io> | 2018-05-23 10:40:34 +0000 |
commit | 5aef87f1557f788384c39226e95157bc4c52c718 (patch) | |
tree | ba08db4361fcfe94a769e1c90736ebbfc65066b1 /src/plugins/qmljstools/qmljslocatordata.cpp | |
parent | 8a45da420a85e4ff94e0f4a893644b831a2e3c71 (diff) |
qmljs: cleanup locator's entries when closing a project
Task-number: QTCREATORBUG-13459
Change-Id: Icebe06a8a49389511a12506728f2109dc0b95287
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Diffstat (limited to 'src/plugins/qmljstools/qmljslocatordata.cpp')
-rw-r--r-- | src/plugins/qmljstools/qmljslocatordata.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/qmljstools/qmljslocatordata.cpp b/src/plugins/qmljstools/qmljslocatordata.cpp index d7ee5e6154..36aa5c4010 100644 --- a/src/plugins/qmljstools/qmljslocatordata.cpp +++ b/src/plugins/qmljstools/qmljslocatordata.cpp @@ -25,6 +25,9 @@ #include "qmljslocatordata.h" +#include <projectexplorer/project.h> +#include <projectexplorer/session.h> + #include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsutils.h> //#include <qmljs/qmljsinterpreter.h> @@ -40,10 +43,25 @@ LocatorData::LocatorData() { ModelManagerInterface *manager = ModelManagerInterface::instance(); + // Force the updating of source file when updating a project (they could be cached, in such + // case LocatorData::onDocumentUpdated will not be called. + connect(manager, &ModelManagerInterface::projectInfoUpdated, + [manager](const ModelManagerInterface::ProjectInfo &info) { + QStringList files; + for (const Utils::FileName &f: info.project->files(ProjectExplorer::Project::SourceFiles)) + files << f.toString(); + manager->updateSourceFiles(files, true); + }); + connect(manager, &ModelManagerInterface::documentUpdated, this, &LocatorData::onDocumentUpdated); connect(manager, &ModelManagerInterface::aboutToRemoveFiles, this, &LocatorData::onAboutToRemoveFiles); + + ProjectExplorer::SessionManager *session = ProjectExplorer::SessionManager::instance(); + if (session) + connect(session, &ProjectExplorer::SessionManager::projectRemoved, + [this] (ProjectExplorer::Project*) { m_entries.clear(); }); } LocatorData::~LocatorData() @@ -233,4 +251,3 @@ void LocatorData::onAboutToRemoveFiles(const QStringList &files) m_entries.remove(file); } } - |