aboutsummaryrefslogtreecommitdiff
path: root/src/subwindow/tabwidget.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2019-02-15 20:37:19 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2019-02-15 20:37:19 +0200
commitbe77ca07e282a233ef44f12fdeb3dec502046580 (patch)
treeb7ccb12fb934cfd5f40c30ac4c5a504d7293386b /src/subwindow/tabwidget.cpp
parentAdd configure script (diff)
downloadsmolbote-be77ca07e282a233ef44f12fdeb3dec502046580.tar.xz
SubWindow: closing tab restores previous index
SubWindow keeps track of its previous tab index, and when a tab is closed, the previous index should be restored.
Diffstat (limited to 'src/subwindow/tabwidget.cpp')
-rw-r--r--src/subwindow/tabwidget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/subwindow/tabwidget.cpp b/src/subwindow/tabwidget.cpp
index 6951b7b..ef15657 100644
--- a/src/subwindow/tabwidget.cpp
+++ b/src/subwindow/tabwidget.cpp
@@ -67,6 +67,12 @@ TabWidget::TabWidget(QWidget *parent)
removeTab(i);
}
});
+
+ //
+ connect(this, &TabWidget::currentChanged, this, [this](int index) {
+ previous = current;
+ current = index;
+ });
}
TabWidget::~TabWidget()
@@ -117,6 +123,7 @@ void TabWidget::removeTab(int index)
m_closedTabs.dequeue();
}
+ setCurrentIndex(previous);
QTabWidget::removeTab(index);
delete w;
}