forked from qt-creator/qt-creator
ProjectExplorer: Add shortcut for switching active project
... when in project mode. We re-use the "GotoPreviousInHistory" action, which is semantically not equivalent, but still seems like the most natural fit. Fixes: QTCREATORBUG-19719 Change-Id: If00a90ce93ac3bd7e079d47eefa69e4f4aeb30cb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -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 <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/coreicons.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
@@ -377,6 +381,14 @@ public:
|
||||
connect(m_projectSelection, QOverload<int>::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);
|
||||
|
||||
Reference in New Issue
Block a user