From cb8742ccab3f17e3320bea10cf5f174839ead687 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 25 Nov 2022 10:52:24 +0100 Subject: [PATCH] Make it possible to select default session from menu when we are in the limbo state where no session has been loaded, and the default session has not been explicitly created or loaded yet. Fixes: QTCREATORBUG-28393 Change-Id: I66d69561e18b5073a477d90c1926074e3cd97cee Reviewed-by: Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/projectexplorer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index c6ee39013b0..c7ed9c192c3 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -4173,6 +4173,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu() auto *ag = new QActionGroup(m_sessionMenu); connect(ag, &QActionGroup::triggered, this, &ProjectExplorerPluginPrivate::setSession); const QString activeSession = SessionManager::activeSession(); + const bool isDefaultVirgin = SessionManager::isDefaultVirgin(); const QStringList sessions = SessionManager::sessions(); for (int i = 0; i < sessions.size(); ++i) { @@ -4184,7 +4185,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu() QAction *act = ag->addAction(actionText); act->setData(session); act->setCheckable(true); - if (session == activeSession) + if (session == activeSession && !isDefaultVirgin) act->setChecked(true); } m_sessionMenu->addActions(ag->actions()); @@ -4193,9 +4194,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu() void ProjectExplorerPluginPrivate::setSession(QAction *action) { - QString session = action->data().toString(); - if (session != SessionManager::activeSession()) - SessionManager::loadSession(session); + SessionManager::loadSession(action->data().toString()); } void ProjectExplorerPlugin::setProjectExplorerSettings(const ProjectExplorerSettings &pes)