diff options
| author | Mike Skec <skec@protonmail.ch> | 2020-12-27 19:00:30 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2020-12-27 11:01:48 +0100 |
| commit | 346618c52e9c9e6d6fe9e91f0ef1a84c05210dc8 (patch) | |
| tree | 0f23de9258d7cc0025741d60642aa7c766cd4f42 /src/mainwindow.cpp | |
| parent | b6ac752e32e6871fbe3226334aabc8e9af7c294b (diff) | |
| download | kristall-346618c52e9c9e6d6fe9e91f0ef1a84c05210dc8.tar.gz | |
Window title now contains page title
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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<BrowserTab*>(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(); + } } } |
