forked from qt-creator/qt-creator
Terminal: Update on set focus after closing tab
Amends 84155e8354
This change sets the focus also on terminals that get destroyed via exit
or Ctrl+D
Change-Id: I9a96ae5b257f3e8a93db7efb4e7d4468b287c143
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -200,6 +200,11 @@ QWidget *TerminalPane::outputWidget(QWidget *parent)
|
|||||||
removeTab(index);
|
removeTab(index);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(m_tabWidget, &QTabWidget::currentChanged, this, [this](int index) {
|
||||||
|
if (auto widget = m_tabWidget->widget(index))
|
||||||
|
widget->setFocus();
|
||||||
|
});
|
||||||
|
|
||||||
auto terminalWidget = new TerminalWidget(parent);
|
auto terminalWidget = new TerminalWidget(parent);
|
||||||
m_tabWidget->addTab(terminalWidget, Tr::tr("Terminal"));
|
m_tabWidget->addTab(terminalWidget, Tr::tr("Terminal"));
|
||||||
setupTerminalWidget(terminalWidget);
|
setupTerminalWidget(terminalWidget);
|
||||||
@@ -221,10 +226,6 @@ void TerminalPane::removeTab(int index)
|
|||||||
|
|
||||||
TerminalCommands::instance().paneActions().closeTerminal.setEnabled(m_tabWidget->count() > 1);
|
TerminalCommands::instance().paneActions().closeTerminal.setEnabled(m_tabWidget->count() > 1);
|
||||||
|
|
||||||
if (auto terminal = currentTerminal()) {
|
|
||||||
terminal->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
emit navigateStateUpdate();
|
emit navigateStateUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user