From bcda97a2e17f6e1366cfe5b03bd0b407d4484255 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Sat, 6 Jun 2020 14:22:53 +0200 Subject: Reworks document rendering: Now generates QTextDocument directly instead of using HTML inbetween. --- mainwindow.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mainwindow.cpp') diff --git a/mainwindow.cpp b/mainwindow.cpp index 48e7f54..aba06f0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -32,6 +32,8 @@ BrowserTab * MainWindow::addEmptyTab(bool focus_new) { BrowserTab * tab = new BrowserTab(this); + connect(tab, &BrowserTab::titleChanged, this, &MainWindow::on_tab_titleChanged); + int index = this->ui->browser_tabs->addTab(tab, "Page"); if(focus_new) { @@ -102,3 +104,23 @@ void MainWindow::on_history_view_doubleClicked(const QModelIndex &index) tab->navigateBack(index); } } + +void MainWindow::on_tab_titleChanged(const QString &title) +{ + auto * tab = qobject_cast(sender()); + if(tab != nullptr) { + int index = this->ui->browser_tabs->indexOf(tab); + assert(index >= 0); + this->ui->browser_tabs->setTabText(index, title); + } +} + +void MainWindow::on_tab_locationChanged(const QUrl &url) +{ + auto * tab = qobject_cast(sender()); + if(tab != nullptr) { + int index = this->ui->browser_tabs->indexOf(tab); + assert(index >= 0); + this->ui->browser_tabs->setTabToolTip(index, url.toString()); + } +} -- cgit v1.2.3