QmlJsTools: Use the startup project for context in the code model

ProjectTree::currentProject is not the right project to track.

Change-Id: Ia9da32a24e73565c4b9a3739c4000c13b803375f
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-01-12 14:04:27 +01:00
parent 31032ffbbe
commit 87faa62fa0
3 changed files with 8 additions and 4 deletions

View File

@@ -51,6 +51,8 @@ CurrentProjectFilter::CurrentProjectFilter()
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
this, &CurrentProjectFilter::currentProjectChanged);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &CurrentProjectFilter::currentProjectChanged);
}
void CurrentProjectFilter::markFilesAsOutOfDate()

View File

@@ -48,6 +48,8 @@ CurrentProjectFind::CurrentProjectFind()
{
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
this, &CurrentProjectFind::handleProjectChanged);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
this, &CurrentProjectFind::handleProjectChanged);
connect(SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(handleProjectChanged()));
connect(SessionManager::instance(), SIGNAL(projectAdded(ProjectExplorer::Project*)),

View File

@@ -223,9 +223,9 @@ void ModelManager::delayedInitialization()
this, SLOT(maybeQueueCppQmlTypeUpdate(CPlusPlus::Document::Ptr)), Qt::DirectConnection);
}
connect(ProjectExplorer::SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(removeProjectInfo(ProjectExplorer::Project*)));
connect(ProjectExplorer::ProjectTree::instance(), &ProjectExplorer::ProjectTree::currentProjectChanged,
connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::projectRemoved,
this, &ModelManager::removeProjectInfo);
connect(ProjectExplorer::SessionManager::instance(), &ProjectExplorer::SessionManager::startupProjectChanged,
this, &ModelManager::updateDefaultProjectInfo);
QmlJS::ViewerContext qbsVContext;
@@ -265,7 +265,7 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
void ModelManager::updateDefaultProjectInfo()
{
// needs to be performed in the ui thread
ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectTree::currentProject();
ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::startupProject();
ProjectInfo newDefaultProjectInfo = projectInfo(currentProject,
defaultProjectInfoForProject(currentProject));
setDefaultProject(projectInfo(currentProject,newDefaultProjectInfo), currentProject);