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:
Cristian Adam
2023-03-23 16:37:58 +01:00
parent 2766b4004b
commit f95bd6119a
3 changed files with 13 additions and 0 deletions

View File

@@ -153,4 +153,13 @@ QAction *TerminalCommands::openSettingsAction()
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

View File

@@ -51,6 +51,8 @@ public:
static QAction *openSettingsAction();
void registerOpenCloseTerminalPaneCommand();
protected:
void initWidgetActions(const Core::Context &context);
void initPaneActions(const Core::Context &context);

View File

@@ -295,6 +295,8 @@ void TerminalPane::setFocus()
{
if (const auto t = currentTerminal())
t->setFocus();
TerminalCommands::instance().registerOpenCloseTerminalPaneCommand();
}
bool TerminalPane::hasFocus() const