diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index e1c1e99a5a..3e2cb79def 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -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, 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;