diff options
author | Yuhang Zhao <2546789017@qq.com> | 2022-11-02 17:30:35 +0800 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-12-05 15:55:53 +0100 |
commit | 732d073351752530a7b6bda0bfe6c2ec264f4bd5 (patch) | |
tree | e854510bae5059ee67e0c7a43859f1fbdf2efc6e /src/plugins/platforms/windows/qwindowswindow.cpp | |
parent | b3dbfdd59782e801fc5bb5e5df3ed71ae4ec2866 (diff) |
Windows QPA: Always apply system background color for top level window
This is a follow-up patch of commit 2991c66b75612dfb11dbba166dd08b2376b42102
We can unset the window background brush and always draw the background
ourself. Qt always paint all pixels anyway when blt'ing the backingstore,
so it should be safe to do this.
Since a theme might not provide a palette (e.g. when desktop setting
awareness is disabled), always use the default application palette.
Change-Id: I4fdc2467b3cc3999dd1acfe9411cec077ca66bd3
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 325e240889..b2e41dca24 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2303,9 +2303,10 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, WPARAM wParam, LPARAM, LRESULT *result) { if (message == WM_ERASEBKGND) { // Backing store - ignored. - if (!m_firstBgDraw && QWindowsIntegration::instance()->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle)) { - // Get system background color - const QColor bgColor = QGuiApplicationPrivate::platformTheme()->palette()->color(QPalette::Window); + if (!m_firstBgDraw) { + // Get window background from the default palette; this will + // usually be the system background color. + const QColor bgColor = QGuiApplication::palette().color(QPalette::Window); HBRUSH bgBrush = CreateSolidBrush(RGB(bgColor.red(), bgColor.green(), bgColor.blue())); // Fill rectangle with system background color RECT rc; |