aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow/widgets')
-rw-r--r--src/mainwindow/widgets/tabwidget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mainwindow/widgets/tabwidget.cpp b/src/mainwindow/widgets/tabwidget.cpp
index 66182c3..97c2717 100644
--- a/src/mainwindow/widgets/tabwidget.cpp
+++ b/src/mainwindow/widgets/tabwidget.cpp
@@ -25,6 +25,13 @@ TabWidget::TabWidget(QWidget *parent)
connect(this, &TabWidget::tabCloseRequested, this, &TabWidget::deleteTab);
+ // when changing tabs, give focus to the widget
+ // otherwise when closing tabs, the tabwidget will retain focus
+ connect(this, &TabWidget::currentChanged, this, [this](int index) {
+ if(widget(index))
+ widget(index)->setFocus();
+ });
+
// context menu
tabContextMenu = new QMenu(this);
auto *closeTab = tabContextMenu->addAction(tr("Close Tab"));