Commit 7b7f3543 authored by hjk's avatar hjk
Browse files

ProjectTree: Always mark startup project (again)



The bold marker was lost after project tree recreation (i.e.
after the Project tree was e.g. switched to Open Documents and back)

Change-Id: If586ef98f2328b3a6fa7c107ac40e4cacb1009bb
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent e07c6383
...@@ -82,11 +82,10 @@ FlatModel::FlatModel(QObject *parent) ...@@ -82,11 +82,10 @@ FlatModel::FlatModel(QObject *parent)
SessionManager *sm = SessionManager::instance(); SessionManager *sm = SessionManager::instance();
connect(sm, &SessionManager::projectRemoved, this, &FlatModel::update); connect(sm, &SessionManager::projectRemoved, this, &FlatModel::update);
connect(sm, &SessionManager::startupProjectChanged, this, &FlatModel::startupProjectChanged);
connect(sm, &SessionManager::sessionLoaded, this, &FlatModel::loadExpandData); connect(sm, &SessionManager::sessionLoaded, this, &FlatModel::loadExpandData);
connect(sm, &SessionManager::aboutToSaveSession, this, &FlatModel::saveExpandData); connect(sm, &SessionManager::aboutToSaveSession, this, &FlatModel::saveExpandData);
connect(sm, &SessionManager::projectAdded, this, &FlatModel::handleProjectAdded); connect(sm, &SessionManager::projectAdded, this, &FlatModel::handleProjectAdded);
connect(sm, &SessionManager::startupProjectChanged, this, [this] { layoutChanged(); });
update(); update();
} }
...@@ -98,15 +97,6 @@ void FlatModel::setView(QTreeView *view) ...@@ -98,15 +97,6 @@ void FlatModel::setView(QTreeView *view)
connect(m_view, &QTreeView::collapsed, this, &FlatModel::onCollapsed); connect(m_view, &QTreeView::collapsed, this, &FlatModel::onCollapsed);
} }
void FlatModel::startupProjectChanged(Project *project)
{
ProjectNode *projectNode = project ? project->rootProjectNode() : nullptr;
if (m_startupProject == projectNode)
return;
m_startupProject = projectNode;
layoutChanged();
}
QVariant FlatModel::data(const QModelIndex &index, int role) const QVariant FlatModel::data(const QModelIndex &index, int role) const
{ {
QVariant result; QVariant result;
...@@ -145,8 +135,10 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const ...@@ -145,8 +135,10 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
} }
case Qt::FontRole: { case Qt::FontRole: {
QFont font; QFont font;
if (node == m_startupProject) if (Project *project = SessionManager::startupProject()) {
font.setBold(true); if (node == project->rootProjectNode())
font.setBold(true);
}
result = font; result = font;
break; break;
} }
......
...@@ -83,7 +83,6 @@ signals: ...@@ -83,7 +83,6 @@ signals:
void renamed(const Utils::FileName &oldName, const Utils::FileName &newName); void renamed(const Utils::FileName &oldName, const Utils::FileName &newName);
private: private:
void startupProjectChanged(Project *project);
void nodeUpdated(ProjectExplorer::Node *node); void nodeUpdated(ProjectExplorer::Node *node);
bool filter(Node *node) const; // Returns true if node is hidden. bool filter(Node *node) const; // Returns true if node is hidden.
...@@ -91,8 +90,6 @@ private: ...@@ -91,8 +90,6 @@ private:
bool m_filterProjects = false; bool m_filterProjects = false;
bool m_filterGeneratedFiles = true; bool m_filterGeneratedFiles = true;
ProjectNode *m_startupProject = nullptr;
static const QLoggingCategory &logger(); static const QLoggingCategory &logger();
void update(); void update();
......
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