From d490f3d9fde23bbe550662f7ceed9f90210fe71c Mon Sep 17 00:00:00 2001 From: Santhosh Kumar Date: Mon, 25 Sep 2023 11:33:24 +0200 Subject: [PATCH] Fix margin issue in wizard for windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch set 8dbc4824895ea9f87d1f6406fe2d22336b6253ed extends support in calculating margins when ExtendsContentIntoTitleBar() is used. But this affects existing QWizard that sets custom margins through Aero style. This is because, the custom margins set by Aero style excludes top margin (titleBarSizeDp()) and excluding it once again cause slicing in the client window area. This patch set fixes it by considering top margin only when system margins is used in windows. Fixes: QTBUG-117428 Pick-to: 6.5 Change-Id: I6d6eefc691f26474257b58304dac169fba20b5e1 Reviewed-by: Qt CI Bot Reviewed-by: Timothée Keller Reviewed-by: Morten Johan Sørvig (cherry picked from commit 58a6a92f688fccf9e841dea6976409d97a6dd3b0) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/windows/qwindowswindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 3a93734da4c..e7fc6d06228 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2784,16 +2784,16 @@ void QWindowsWindow::calculateFullFrameMargins() RECT clientRect{}; GetWindowRect(handle(), &windowRect); GetClientRect(handle(), &clientRect); - const int yDiff = (windowRect.bottom - windowRect.top) - clientRect.bottom; + const int yDiff = (windowRect.bottom - windowRect.top) - (clientRect.bottom - clientRect.top); const bool typicalFrame = (systemMargins.left() == systemMargins.right()) && (systemMargins.right() == systemMargins.bottom()); const QMargins adjustedMargins = typicalFrame ? - QMargins(systemMargins.left(), yDiff - systemMargins.bottom(), + QMargins(systemMargins.left(), (yDiff - systemMargins.bottom()), systemMargins.right(), systemMargins.bottom()) - : systemMargins; + : systemMargins + customMargins(); - setFullFrameMargins(adjustedMargins + customMargins()); + setFullFrameMargins(adjustedMargins); } QMargins QWindowsWindow::frameMargins() const