From 7ce5b4f486e60197427d1cecd850f3585e6a8b54 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 23 Nov 2024 20:49:29 +0100 Subject: [PATCH] QWindows11Style: Adjust position of MDI subwindow icon The y position for the MDI subwindow icon was not calculated correctly so the icon was not painted vertically centered. Task-number: QTBUG-130673 Change-Id: I5f9023820a4e4b4288017869ac4088fe2669ce50 Reviewed-by: Wladimir Leuschner Reviewed-by: Volker Hilsheimer (cherry picked from commit 6e29a94b547fbafa69e97ac02aeb33edad63f2ae) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 1319dcf472b97652883f01bdb411e7719d1cc2e4) --- src/plugins/styles/modernwindows/qwindows11style.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index c7e11b899ea..03f94c73329 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -1921,8 +1921,9 @@ QRect QWindows11Style::subControlRect(ComplexControl control, const QStyleOption break; case SC_TitleBarSysMenu: if (titlebar->titleBarFlags & Qt::WindowSystemMenuHint) { - ret.setRect(titlebar->rect.left() + controlWidthMargin + indent, titlebar->rect.top() + iconSize/2, - iconSize, iconSize); + const auto yOfs = titlebar->rect.top() + (titlebar->rect.height() - iconSize) / 2; + ret.setRect(titlebar->rect.left() + controlWidthMargin + indent, yOfs, iconSize, + iconSize); } break; default: