Commit a39691d3 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

konsole: Hide toolview on Esc keypress

parent d07429c7
......@@ -160,6 +160,8 @@ KateConsole::KateConsole(KateKonsolePlugin *plugin, KTextEditor::MainWindow *mw,
actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_F4));
connect(a, &QAction::triggered, this, &KateConsole::slotToggleFocus);
connect(m_mw, &KTextEditor::MainWindow::unhandledShortcutOverride, this, &KateConsole::handleEsc);
m_mw->guiFactory()->addClient(this);
readConfig();
......@@ -466,6 +468,20 @@ void KateConsole::readConfig()
}
}
void KateConsole::handleEsc(QEvent *e)
{
if (!m_mw) {
return;
}
QKeyEvent *k = static_cast<QKeyEvent *>(e);
if (k->key() == Qt::Key_Escape && k->modifiers() == Qt::NoModifier) {
if (m_toolView->isVisible()) {
m_mw->hideToolView(m_toolView);
}
}
}
KateKonsoleConfigPage::KateKonsoleConfigPage(QWidget *parent, KateKonsolePlugin *plugin)
: KTextEditor::ConfigPage(parent)
, mPlugin(plugin)
......
......@@ -175,6 +175,11 @@ private Q_SLOTS:
*/
void overrideShortcut(QKeyEvent *event, bool &override);
/**
* hide terminal on Esc key press
*/
void handleEsc(QEvent *e);
protected:
/**
* the konsole get shown
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment