diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 93f003b7b29..aaf21160ba4 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -234,9 +234,6 @@ const char SELECTTARGETQUICK[] = "ProjectExplorer.SelectTargetQuick"; const int P_ACTION_RUN = 100; const int P_ACTION_BUILDPROJECT = 80; -// Context -const char C_PROJECTEXPLORER[] = "Project Explorer"; - // Menus const char M_RECENTPROJECTS[] = "ProjectExplorer.Menu.Recent"; const char M_UNLOADPROJECTS[] = "ProjectExplorer.Menu.Unload"; diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index c76f1acda1d..cc115322829 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -42,6 +42,7 @@ const char RENAMEFILE[] = "ProjectExplorer.RenameFile"; const char REMOVEFILE[] = "ProjectExplorer.RemoveFile"; // Context +const char C_PROJECTEXPLORER[] = "Project Explorer"; const char C_PROJECT_TREE[] = "ProjectExplorer.ProjectTreeContext"; // Menus diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index dfa20793e31..267a8626b96 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -26,6 +26,7 @@ #include "projectwindow.h" #include "buildinfo.h" +#include "projectexplorerconstants.h" #include "kit.h" #include "kitmanager.h" #include "kitoptionspage.h" @@ -38,6 +39,9 @@ #include "target.h" #include "targetsettingspanel.h" +#include +#include +#include #include #include #include @@ -377,6 +381,14 @@ public: connect(m_projectSelection, QOverload::of(&QComboBox::activated), this, &ProjectWindowPrivate::projectSelected, Qt::QueuedConnection); + const auto switchProjectAction = new QAction(this); + ActionManager::registerAction(switchProjectAction, Core::Constants::GOTOPREVINHISTORY, + Context(Constants::C_PROJECTEXPLORER)); + connect(switchProjectAction, &QAction::triggered, this, [this] { + if (m_projectSelection->count() > 1) + m_projectSelection->showPopup(); + }); + SessionManager *sessionManager = SessionManager::instance(); connect(sessionManager, &SessionManager::projectAdded, this, &ProjectWindowPrivate::registerProject);