aboutsummaryrefslogtreecommitdiff
path: root/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r--mainwindow.cpp22
1 files changed, 22 insertions, 0 deletions
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<BrowserTab*>(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<BrowserTab*>(sender());
+ if(tab != nullptr) {
+ int index = this->ui->browser_tabs->indexOf(tab);
+ assert(index >= 0);
+ this->ui->browser_tabs->setTabToolTip(index, url.toString());
+ }
+}