From 9ee987f8216b412957ffcb46c01bbe268b282746 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Thu, 24 Dec 2020 18:27:04 +1100 Subject: theme changes are now reflected instantly upon confirmation. --- src/mainwindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6d1964a..b129414 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -163,6 +163,11 @@ void MainWindow::on_browser_tabs_currentChanged(int index) this->ui->history_view->setModel(&tab->history); this->setFileStatus(tab->current_stats); + + if (tab->needs_rerender) + { + tab->rerenderPage(); + } } else { this->ui->outline_view->setModel(nullptr); this->ui->history_view->setModel(nullptr); @@ -252,6 +257,17 @@ void MainWindow::on_actionSettings_triggered() kristall::saveSettings(); kristall::setTheme(kristall::options.theme); + + // Flag open tabs for re-render so theme + // changes are instantly applied. + for (int i = 0; i < this->ui->browser_tabs->count(); ++i) + { + qobject_cast(this->ui->browser_tabs->widget(i)) + ->needs_rerender = true; + } + // Re-render the currently-open tab if we have one. + BrowserTab * tab = qobject_cast(this->ui->browser_tabs->currentWidget()); + if (tab) tab->rerenderPage(); } void MainWindow::on_actionNew_Tab_triggered() -- cgit v1.2.3