Commit 38924e38 authored by dt's avatar dt
Browse files

On loading a project, select it in the project tree view



This fixes the issue that when loading a project in a big session the
newly loaded project is hard to find. The solution is a bit of a hack.
Reviewed-by: default avatarmae <qt-info@nokia.com>
parent 9c03475c
...@@ -120,7 +120,8 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) ...@@ -120,7 +120,8 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
m_view(0), m_view(0),
m_model(0), m_model(0),
m_filterProjectsAction(0), m_filterProjectsAction(0),
m_autoSync(false) m_autoSync(false),
m_currentItemLocked(false)
{ {
m_model = new FlatModel(m_explorer->session()->sessionNode(), this); m_model = new FlatModel(m_explorer->session()->sessionNode(), this);
NodesWatcher *watcher = new NodesWatcher(this); NodesWatcher *watcher = new NodesWatcher(this);
...@@ -249,6 +250,10 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project) ...@@ -249,6 +250,10 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project)
if (debug) if (debug)
qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : "0") qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : "0")
<< ", " << (node ? node->path() : "0") << ")"; << ", " << (node ? node->path() : "0") << ")";
if (m_currentItemLocked) {
m_currentItemLocked = false;
return;
}
if (!project) { if (!project) {
return; return;
} }
...@@ -288,6 +293,8 @@ void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project) ...@@ -288,6 +293,8 @@ void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project)
Node *node = project->rootProjectNode(); Node *node = project->rootProjectNode();
QModelIndex idx = m_model->indexForNode(node); QModelIndex idx = m_model->indexForNode(node);
m_view->setExpanded(idx, true); m_view->setExpanded(idx, true);
m_view->setCurrentIndex(idx);
m_currentItemLocked = true;
} }
void ProjectTreeWidget::startupProjectChanged(ProjectExplorer::Project *project) void ProjectTreeWidget::startupProjectChanged(ProjectExplorer::Project *project)
......
...@@ -89,7 +89,7 @@ private: ...@@ -89,7 +89,7 @@ private:
QModelIndex m_subIndex; QModelIndex m_subIndex;
QString m_modelId; QString m_modelId;
bool m_autoSync; bool m_autoSync;
bool m_currentItemLocked;
friend class ProjectTreeWidgetFactory; friend class ProjectTreeWidgetFactory;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment