From 92d8c740d414f8a55d2676379383e1dda6fc8ca3 Mon Sep 17 00:00:00 2001 From: KamFretoZ <14798312+kamfretoz@users.noreply.github.com> Date: Sun, 18 Aug 2024 23:09:16 +0700 Subject: [PATCH] Qt: Fix a couple of theme switching glitches Backport from: https://github.com/stenzek/duckstation/commit/6f9e8efee54e25a57cc17d41bc9ccc10aff6a001 --- pcsx2-qt/Themes.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pcsx2-qt/Themes.cpp b/pcsx2-qt/Themes.cpp index bc7e788636..69448b90b8 100644 --- a/pcsx2-qt/Themes.cpp +++ b/pcsx2-qt/Themes.cpp @@ -20,6 +20,7 @@ namespace QtHost } // namespace QtHost static QString s_unthemed_style_name; +static QPalette s_unthemed_palette; static bool s_unthemed_style_name_set; const char* QtHost::GetDefaultThemeName() @@ -37,6 +38,7 @@ void QtHost::UpdateApplicationTheme() { s_unthemed_style_name_set = true; s_unthemed_style_name = QApplication::style()->objectName(); + s_unthemed_palette = QApplication::palette(); } SetStyleFromSettings(); @@ -49,7 +51,7 @@ void QtHost::SetStyleFromSettings() // setPalette() shouldn't be necessary, as the documentation claims that setStyle() resets the palette, but it // is here, to work around a bug in 6.4.x and 6.5.x where the palette doesn't restore after changing themes. - qApp->setPalette(QPalette()); + qApp->setPalette(QPalette(s_unthemed_palette)); if (theme == "fusion") {