diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-27 18:39:41 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-05-27 18:39:41 +0200 |
commit | d8481551d623f6f19e359805b5ad6fbd28356ed2 (patch) | |
tree | f71eea3253fd9718ab178f3804371f6e6404ac42 /src/mainwindow/widgets | |
parent | Back/Forward menu shortcuts (diff) | |
download | smolbote-d8481551d623f6f19e359805b5ad6fbd28356ed2.tar.xz |
Focus view when changing tabs
Diffstat (limited to 'src/mainwindow/widgets')
-rw-r--r-- | src/mainwindow/widgets/tabwidget.cpp | 7 |
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")); |