summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothée Keller <[email protected]>2024-01-09 15:52:50 +0100
committerQt Cherry-pick Bot <[email protected]>2024-03-09 00:10:25 +0000
commitff9a3e51d38d11aaf65e9e607c4413be4056218c (patch)
tree5c056b2c198ea7139e24f9b74f870a9491f1365c
parentd09dd5b945ba2b836cadd8d943bdb5a757a2f8fd (diff)
Windows QPA: Include custom margins in atypical margins
When calculating atypical margins that are used with ExtendsContentIntoTitleBar, the margins were checked against systemmargins, and then custom margins were added later. Instead, add the custom margins immediately and take them into account during calculations. Pick-to: 6.5 Change-Id: I44af663c85b8bdf080d769e3b38431cbe5df64f3 Reviewed-by: David Faure <[email protected]> (cherry picked from commit 82e8f9e4571c50be476f8e38f9239c5b0c6be32c) Reviewed-by: Volker Hilsheimer <[email protected]> (cherry picked from commit acb5a72ef0f48c3b48ae81388580fd8a9a38fd77) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 4863b06b095..a9c4d921ec5 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -2799,15 +2799,16 @@ void QWindowsWindow::calculateFullFrameMargins()
const auto systemMargins = testFlag(DisableNonClientScaling)
? QWindowsGeometryHint::frameOnPrimaryScreen(window(), m_data.hwnd)
: frameMargins_sys();
+ const QMargins actualMargins = systemMargins + customMargins();
const int yDiff = (windowRect.bottom - windowRect.top) - (clientRect.bottom - clientRect.top);
- const bool typicalFrame = (systemMargins.left() == systemMargins.right())
- && (systemMargins.right() == systemMargins.bottom());
+ const bool typicalFrame = (actualMargins.left() == actualMargins.right())
+ && (actualMargins.right() == actualMargins.bottom());
const QMargins adjustedMargins = typicalFrame ?
- QMargins(systemMargins.left(), (yDiff - systemMargins.bottom()),
- systemMargins.right(), systemMargins.bottom())
- : systemMargins + customMargins();
+ QMargins(actualMargins.left(), (yDiff - actualMargins.bottom()),
+ actualMargins.right(), actualMargins.bottom())
+ : actualMargins;
setFullFrameMargins(adjustedMargins);
}