summaryrefslogtreecommitdiff
path: root/src/tabbar/tabbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabbar/tabbar.cpp')
-rw-r--r--src/tabbar/tabbar.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tabbar/tabbar.cpp b/src/tabbar/tabbar.cpp
index 9bb05d43..fb5c0444 100644
--- a/src/tabbar/tabbar.cpp
+++ b/src/tabbar/tabbar.cpp
@@ -27,6 +27,15 @@ TabBar::TabBar(QWidget *parent) : QTabBar(parent)
setMovable(true);
setAcceptDrops(true);
+ connect(this, &QTabBar::currentChanged, this, [this](int index) {
+ if (index == -1) {
+ emit currentChanged(nullptr);
+ return;
+ }
+ auto view = m_views.at(index);
+ Q_ASSERT(!view.isNull());
+ emit currentChanged(view);
+ });
connect(this, &QTabBar::tabMoved, this, [this](int from, int to) { m_views.move(from, to); });
connect(this, &QTabBar::tabCloseRequested, this, [this](int index) {
@@ -595,4 +604,4 @@ void TabBar::unpinTab()
SessionManager::self()->saveSession();
}
-*/ \ No newline at end of file
+*/