aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorFelix "xq" Queißner <git@masterq32.de>2021-11-20 15:16:34 +0100
committerFelix "xq" Queißner <git@masterq32.de>2021-11-20 15:16:34 +0100
commit6b39f24484bb0796f3f383401f95904f85b74d7b (patch)
treee2dcc6c5782e8a45662b8a79d39049205a7de6f8 /src/mainwindow.cpp
parent9dd660d66e23f02716d4b2bad84ac86764de71a6 (diff)
downloadkristall-6b39f24484bb0796f3f383401f95904f85b74d7b.tar.gz
Implements #245
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d2eeaf8..32f36c8 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -146,6 +146,7 @@ BrowserTab * MainWindow::addEmptyTab(bool focus_new, bool load_default)
{
BrowserTab * tab = new BrowserTab(this);
+ connect(tab, &BrowserTab::destroyed, this, &MainWindow::on_tab_closed);
connect(tab, &BrowserTab::titleChanged, this, &MainWindow::on_tab_titleChanged);
connect(tab, &BrowserTab::fileLoaded, this, &MainWindow::on_tab_fileLoaded);
connect(tab, &BrowserTab::requestStateChanged, this, &MainWindow::on_tab_requestStateChanged);
@@ -366,6 +367,16 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept();
}
+void MainWindow::on_tab_closed()
+{
+ // If the user wants, we close the window together with the last tab.
+ // tabCount() might be 1 here, as the tab is still counted as "open"
+ if(kristall::globals().options.close_window_with_last_tab and (this->tabCount() <= 1))
+ {
+ this->close();
+ }
+}
+
void MainWindow::on_browser_tabs_currentChanged(int index)
{
if(index >= 0) {