From 346618c52e9c9e6d6fe9e91f0ef1a84c05210dc8 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Sun, 27 Dec 2020 19:00:30 +1100 Subject: Window title now contains page title --- src/mainwindow.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fc0d94e..91a865f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -149,6 +149,17 @@ void MainWindow::viewPageSource() } } +void MainWindow::updateWindowTitle() +{ + BrowserTab * tab = qobject_cast(this->ui->browser_tabs->currentWidget()); + if (tab == nullptr || tab->page_title.isEmpty()) + { + this->setWindowTitle("Kristall"); + return; + } + this->setWindowTitle(QString("%0 - %1").arg(tab->page_title, "Kristall")); +} + void MainWindow::on_browser_tabs_currentChanged(int index) { if(index >= 0) { @@ -176,6 +187,7 @@ void MainWindow::on_browser_tabs_currentChanged(int index) this->ui->history_view->setModel(nullptr); this->setFileStatus(DocumentStats { }); } + updateWindowTitle(); } //void MainWindow::on_favourites_view_doubleClicked(const QModelIndex &index) @@ -205,6 +217,11 @@ void MainWindow::on_tab_titleChanged(const QString &title) int index = this->ui->browser_tabs->indexOf(tab); assert(index >= 0); this->ui->browser_tabs->setTabText(index, title); + + if (tab == this->ui->browser_tabs->currentWidget()) + { + updateWindowTitle(); + } } } -- cgit v1.2.3