Skip to content

Commit

Permalink
Windows theme: don't refresh anything unless theme really changed
Browse files Browse the repository at this point in the history
Refreshing the global theme may be expensive for large scale applications, and even if Windows sent corresponding message,
it may be triggered by many reasons, not just the system theme,
so no matter what we'd better add an extra check.

Pick-to: 6.9
Change-Id: I70847aa54fb4af37c81855a62330a4bce31ff104
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
  • Loading branch information
wangwenx190 committed Dec 11, 2024
1 parent d10e917 commit 9b924a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plugins/platforms/windows/qwindowstheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,16 +604,16 @@ void QWindowsTheme::handleSettingsChanged()
const auto newColorScheme = effectiveColorScheme();
const bool colorSchemeChanged = newColorScheme != oldColorScheme;
s_colorScheme = newColorScheme;
if (!colorSchemeChanged)
return;
auto integration = QWindowsIntegration::instance();
integration->updateApplicationBadge();
if (integration->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle)) {
QWindowsTheme::instance()->refresh();
QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();
}
if (colorSchemeChanged) {
for (QWindowsWindow *w : std::as_const(QWindowsContext::instance()->windows()))
w->setDarkBorder(s_colorScheme == Qt::ColorScheme::Dark);
}
for (QWindowsWindow *w : std::as_const(QWindowsContext::instance()->windows()))
w->setDarkBorder(s_colorScheme == Qt::ColorScheme::Dark);
}

void QWindowsTheme::clearPalettes()
Expand Down

0 comments on commit 9b924a4

Please sign in to comment.