Windows theme: don't refresh anything unless theme really changed
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. Change-Id: I70847aa54fb4af37c81855a62330a4bce31ff104 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 9b924a4907a4a2b27ee52e807fd419caf219f655) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b2bb9ef0f1
commit
d1c0eb2291
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user