diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2017-04-07 16:33:36 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2017-04-11 13:22:54 +0000 |
commit | c2483427f1d68ea280a52784df5a23225ab0072b (patch) | |
tree | 2c77a4949aff83026752aa3d1a7a2d892b1e9cf2 /src/libs/utils/appmainwindow.cpp | |
parent | 5cf8fbabda4e2570a3115ae3ef8f4715c04b5bd8 (diff) |
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/appmainwindow.cpp')
-rw-r--r-- | src/libs/utils/appmainwindow.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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 <windows.h> @@ -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); } |