summaryrefslogtreecommitdiff
path: root/src/libs/utils/theme
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2017-04-07 16:33:36 +0200
committerAlessandro Portale <alessandro.portale@qt.io>2017-04-11 13:22:54 +0000
commitc2483427f1d68ea280a52784df5a23225ab0072b (patch)
tree2c77a4949aff83026752aa3d1a7a2d892b1e9cf2 /src/libs/utils/theme
parent5cf8fbabda4e2570a3115ae3ef8f4715c04b5bd8 (diff)
downloadqt-creator-c2483427f1d68ea280a52784df5a23225ab0072b.tar.gz
Utils: Keep correct palette for dark themers after suspend
Sleep, hibernation and user sign-in can cause a ThemeChange event. That event resets the application palette, discarding a palette that may have been previously set. Dark themes in Qt Creator want to set and keep their custom application palettes. So, this change sets the custom application palette on each ThemeChange event that is send to the main window. Task-number: QTCREATORBUG-14929 Change-Id: Ic9fb0111cfa0e8171b819d687f280c3db6cc8f2c Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/libs/utils/theme')
-rw-r--r--src/libs/utils/theme/theme.cpp9
-rw-r--r--src/libs/utils/theme/theme_p.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp
index b8147de046..061ff335cc 100644
--- a/src/libs/utils/theme/theme.cpp
+++ b/src/libs/utils/theme/theme.cpp
@@ -57,14 +57,19 @@ Theme *proxyTheme()
return new Theme(m_creatorTheme);
}
+void setThemeApplicationPalette()
+{
+ if (m_creatorTheme && m_creatorTheme->flag(Theme::ApplyThemePaletteGlobally))
+ QApplication::setPalette(m_creatorTheme->palette());
+}
+
void setCreatorTheme(Theme *theme)
{
if (m_creatorTheme == theme)
return;
delete m_creatorTheme;
m_creatorTheme = theme;
- if (theme && theme->flag(Theme::ApplyThemePaletteGlobally))
- QApplication::setPalette(theme->palette());
+ setThemeApplicationPalette();
}
Theme::Theme(const QString &id, QObject *parent)
diff --git a/src/libs/utils/theme/theme_p.h b/src/libs/utils/theme/theme_p.h
index 4170ec7cd9..1feeeda4e2 100644
--- a/src/libs/utils/theme/theme_p.h
+++ b/src/libs/utils/theme/theme_p.h
@@ -51,5 +51,6 @@ public:
};
QTCREATOR_UTILS_EXPORT void setCreatorTheme(Theme *theme);
+QTCREATOR_UTILS_EXPORT void setThemeApplicationPalette();
} // namespace Utils