From 297795a654037baa92e6d8db8395c7d1bf7a7d1a Mon Sep 17 00:00:00 2001 From: xiaoyifang <105986+xiaoyifang@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:55:08 +0800 Subject: [PATCH] fix: refresh webview when changed darkreader mode (#1641) * fix: refresh webview when changed darkreader mode * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/ui/articleview.cc | 2 +- src/ui/mainwindow.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/articleview.cc b/src/ui/articleview.cc index 59108924..8ad840e6 100644 --- a/src/ui/articleview.cc +++ b/src/ui/articleview.cc @@ -1324,7 +1324,7 @@ void ArticleView::syncBackgroundColorWithCfgDarkReader() const // Only works Qt6.6.3+ https://bugreports.qt.io/browse/QTBUG-112013 #if QT_VERSION >= QT_VERSION_CHECK( 6, 6, 3 ) if ( cfg.preferences.darkReaderMode ) { - webview->page()->setBackgroundColor( Qt::black ); + webview->page()->setBackgroundColor( QColor( 39, 40, 40 ) ); } else { webview->page()->setBackgroundColor( Qt::white ); diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index dfcfad12..c37ef5df 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -2225,6 +2225,7 @@ void MainWindow::editPreferences() auto & view = dynamic_cast< ArticleView & >( *( ui.tabWidget->widget( x ) ) ); view.setSelectionBySingleClick( p.selectWordBySingleClick ); + view.syncBackgroundColorWithCfgDarkReader(); if ( needReload ) { view.reload(); }