aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2020-12-24 18:27:04 +1100
committerFelix Queißner <felix@ib-queissner.de>2020-12-24 09:21:59 +0100
commit9ee987f8216b412957ffcb46c01bbe268b282746 (patch)
tree971602fd748c29f5a9e4defe555f9d581430ebb3 /src/mainwindow.cpp
parent237d3a8bc9ed6be7196115e0c7b640ca59349b1d (diff)
downloadkristall-9ee987f8216b412957ffcb46c01bbe268b282746.tar.gz
theme changes are now reflected instantly upon confirmation.
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp16
1 files changed, 16 insertions, 0 deletions
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<BrowserTab*>(this->ui->browser_tabs->widget(i))
+ ->needs_rerender = true;
+ }
+ // Re-render the currently-open tab if we have one.
+ BrowserTab * tab = qobject_cast<BrowserTab*>(this->ui->browser_tabs->currentWidget());
+ if (tab) tab->rerenderPage();
}
void MainWindow::on_actionNew_Tab_triggered()