Skip to content

Truly independent web browser

UI/Qt: Restyle the window chrome on a theme change, too

sideshowbarkerbcbeb9e26e72
diff --git a/UI/Qt/BrowserWindow.cpp b/UI/Qt/BrowserWindow.cpp
index ba1a536936e..4b007b15f41 100644
--- a/UI/Qt/BrowserWindow.cpp
+++ b/UI/Qt/BrowserWindow.cpp
@@ -1908,7 +1908,9 @@ void BrowserWindow::resizeEvent(QResizeEvent* event)
void BrowserWindow::changeEvent(QEvent* event)
{
- if (event->type() == QEvent::PaletteChange) {
+ // NB: The chrome's colors follow the color scheme as well as the palette, and a color scheme change can leave the
+ // palette as it was, so that only a ThemeChange arrives.
+ if (event->type() == QEvent::PaletteChange || event->type() == QEvent::ApplicationPaletteChange || event->type() == QEvent::ThemeChange) {
update_chrome_style();
update_menu_bar_window_control_icons();
update_tab_button_icons();
diff --git a/UI/Qt/TabBar.cpp b/UI/Qt/TabBar.cpp
index 0d0e4ed325e..400f89231fa 100644
--- a/UI/Qt/TabBar.cpp
+++ b/UI/Qt/TabBar.cpp
@@ -3907,7 +3907,9 @@ void TabWidget::set_vertical_tabs_position(WebView::VerticalTabsPosition positio
bool TabWidget::event(QEvent* event)
{
- if (auto type = event->type(); type == QEvent::PaletteChange) {
+ // NB: The chrome's colors follow the color scheme as well as the palette, and a color scheme change can leave the
+ // palette as it was, so that only a ThemeChange arrives.
+ if (auto type = event->type(); type == QEvent::PaletteChange || type == QEvent::ApplicationPaletteChange || type == QEvent::ThemeChange) {
recreate_icons();
update_chrome_style();
} else if (type == QEvent::WindowStateChange) {