Windows QPA: Always apply system background color for top level window
This is a follow-up patch of commit 2991c66b75
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>
This commit is contained in:
parent
b3dbfdd597
commit
732d073351
@ -541,7 +541,7 @@ QString QWindowsContext::registerWindowClass(const QWindow *w)
|
||||
if (icon)
|
||||
cname += "Icon"_L1;
|
||||
|
||||
return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon);
|
||||
return registerWindowClass(cname, qWindowsWndProc, style, nullptr, icon);
|
||||
}
|
||||
|
||||
QString QWindowsContext::registerWindowClass(QString cname,
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user