summaryrefslogtreecommitdiff
path: root/src/rekonqwindow.cpp
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/rekonqwindow.cpp
parentAdd rekonq::DefaultUrl enum (diff)
downloadrekonq-fd5f068ae912bec800df24fcac624fb1e3d9593e.tar.xz
Close main window after last tab is closed
Diffstat (limited to 'src/rekonqwindow.cpp')
-rw-r--r--src/rekonqwindow.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rekonqwindow.cpp b/src/rekonqwindow.cpp
index ef772936..f969622c 100644
--- a/src/rekonqwindow.cpp
+++ b/src/rekonqwindow.cpp
@@ -23,9 +23,11 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Re
{
ui->setupUi(this);
- connect(ui->tabs, &QTabBar::currentChanged, this, [this](int index) {
- auto *view = ui->tabs->view(index);
- Q_CHECK_PTR(view);
+ connect(ui->tabs, &TabBar::currentChanged, this, [this](RekonqView *view) {
+ if (view == nullptr) { // last tab has been closed
+ close();
+ return;
+ }
ui->views->setCurrentWidget(view);
ui->urlBar->setCurrentView(view);