diff --git a/src/libs/utils/appmainwindow.cpp b/src/libs/utils/appmainwindow.cpp index 7c9a8afe1fb..bdeb3a4cbf9 100644 --- a/src/libs/utils/appmainwindow.cpp +++ b/src/libs/utils/appmainwindow.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "appmainwindow.h" +#include "theme/theme_p.h" #ifdef Q_OS_WIN #include @@ -60,11 +61,14 @@ void AppMainWindow::raiseWindow() #ifdef Q_OS_WIN bool AppMainWindow::event(QEvent *event) { - if (event->type() == m_deviceEventId) { + const QEvent::Type type = event->type(); + if (type == m_deviceEventId) { event->accept(); emit deviceChange(); return true; } + if (type == QEvent::ThemeChange) + setThemeApplicationPalette(); return QMainWindow::event(event); } diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp index b8147de0464..061ff335ccf 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 4170ec7cd9f..1feeeda4e25 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