summaryrefslogtreecommitdiff
path: root/src/tabbar
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-09-03 15:00:06 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-09-05 23:07:42 +0300
commitfd5f068ae912bec800df24fcac624fb1e3d9593e (patch)
tree0d3a4722e365710a416613a762519f73e5bfe5e4 /src/tabbar
parentAdd rekonq::DefaultUrl enum (diff)
downloadrekonq-fd5f068ae912bec800df24fcac624fb1e3d9593e.tar.xz
Close main window after last tab is closed
Diffstat (limited to 'src/tabbar')
-rw-r--r--src/tabbar/tabbar.cpp11
-rw-r--r--src/tabbar/tabbar.h1
2 files changed, 11 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
+*/
diff --git a/src/tabbar/tabbar.h b/src/tabbar/tabbar.h
index 077255a4..793e2acf 100644
--- a/src/tabbar/tabbar.h
+++ b/src/tabbar/tabbar.h
@@ -36,6 +36,7 @@ public:
}
signals:
+ void currentChanged(RekonqView *view);
void removeView(RekonqView *);
protected: