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>
This commit is contained in:
xiaoyifang 2024-07-05 10:55:08 +08:00 committed by GitHub
parent 66dd9b98f2
commit 297795a654
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -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 );

View file

@ -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();
}