forked from qt-creator/qt-creator
Terminal: Register the command to open/close the Terminal pane
This way Alt+5 (Ctrl+5) would open / close the Terminal pane. Change-Id: I91003987c1b8109abc302a79a895fab1557fefea Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -153,4 +153,13 @@ QAction *TerminalCommands::openSettingsAction()
|
|||||||
return ActionManager::command("Preferences.Terminal.General")->action();
|
return ActionManager::command("Preferences.Terminal.General")->action();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TerminalCommands::registerOpenCloseTerminalPaneCommand()
|
||||||
|
{
|
||||||
|
Command* terminalCmd = ActionManager::command("QtCreator.Pane.Terminal");
|
||||||
|
QTC_ASSERT(terminalCmd, return);
|
||||||
|
|
||||||
|
if (!m_commands.contains(terminalCmd))
|
||||||
|
m_commands.append(terminalCmd);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Terminal
|
} // namespace Terminal
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public:
|
|||||||
|
|
||||||
static QAction *openSettingsAction();
|
static QAction *openSettingsAction();
|
||||||
|
|
||||||
|
void registerOpenCloseTerminalPaneCommand();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initWidgetActions(const Core::Context &context);
|
void initWidgetActions(const Core::Context &context);
|
||||||
void initPaneActions(const Core::Context &context);
|
void initPaneActions(const Core::Context &context);
|
||||||
|
|||||||
@@ -295,6 +295,8 @@ void TerminalPane::setFocus()
|
|||||||
{
|
{
|
||||||
if (const auto t = currentTerminal())
|
if (const auto t = currentTerminal())
|
||||||
t->setFocus();
|
t->setFocus();
|
||||||
|
|
||||||
|
TerminalCommands::instance().registerOpenCloseTerminalPaneCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TerminalPane::hasFocus() const
|
bool TerminalPane::hasFocus() const
|
||||||
|
|||||||
Reference in New Issue
Block a user