Qt: Fix a couple of theme switching glitches

Backport from: 6f9e8efee5
This commit is contained in:
KamFretoZ 2024-08-18 23:09:16 +07:00 committed by lightningterror
parent b6eddade00
commit 92d8c740d4
1 changed files with 3 additions and 1 deletions

View File

@ -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")
{