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: mae <qt-info@nokia.com>
This commit is contained in:
dt
2010-01-07 20:35:23 +01:00
parent 9c03475c8f
commit 38924e3863
2 changed files with 9 additions and 2 deletions

View File

@@ -120,7 +120,8 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
m_view(0),
m_model(0),
m_filterProjectsAction(0),
m_autoSync(false)
m_autoSync(false),
m_currentItemLocked(false)
{
m_model = new FlatModel(m_explorer->session()->sessionNode(), this);
NodesWatcher *watcher = new NodesWatcher(this);
@@ -249,6 +250,10 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project)
if (debug)
qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : "0")
<< ", " << (node ? node->path() : "0") << ")";
if (m_currentItemLocked) {
m_currentItemLocked = false;
return;
}
if (!project) {
return;
}
@@ -288,6 +293,8 @@ void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project)
Node *node = project->rootProjectNode();
QModelIndex idx = m_model->indexForNode(node);
m_view->setExpanded(idx, true);
m_view->setCurrentIndex(idx);
m_currentItemLocked = true;
}
void ProjectTreeWidget::startupProjectChanged(ProjectExplorer::Project *project)

View File

@@ -89,7 +89,7 @@ private:
QModelIndex m_subIndex;
QString m_modelId;
bool m_autoSync;
bool m_currentItemLocked;
friend class ProjectTreeWidgetFactory;
};