diff options
author | Timothée Keller <timothee.keller@qt.io> | 2024-01-09 15:52:50 +0100 |
---|---|---|
committer | Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> | 2024-03-05 15:43:29 +0100 |
commit | 82e8f9e4571c50be476f8e38f9239c5b0c6be32c (patch) | |
tree | 63811a65355363a2f15be1d8553e71a91ab49d1a /src/plugins/platforms | |
parent | c785d56ae084d01a565aaf0fa2fa86a0682c461d (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.7 6.6 6.5
Change-Id: I44af663c85b8bdf080d769e3b38431cbe5df64f3
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c2c093faf4..220c36cc19 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2808,15 +2808,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); } |