summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-10-17 10:35:28 +0200
committerLiang Qi <liang.qi@qt.io>2018-10-17 10:35:28 +0200
commitccf26f6a88e116abdf8e53acdc02dbd98a4a8dc4 (patch)
tree40aaca99471edc709d38e6f82153576bad86747f /src/plugins/platforms/cocoa/qcocoawindow.mm
parent8ff1ae89bfa32c586e3b44b71dfc49d294a3e043 (diff)
parent3eebadc1734463afa469dcd08eab8c5d2557dec6 (diff)
Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts: src/plugins/platformthemes/platformthemes.pro src/printsupport/kernel/qplatformprintdevice.cpp Change-Id: Iac01729ad954bb1c7af5867d982eb243b2139ee6
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 1de8577ebe..98e48a8b70 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1719,6 +1719,14 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
[window setStyleMask:[window styleMask] | NSWindowStyleMaskTexturedBackground];
window.titlebarAppearsTransparent = YES;
+ // Setting titlebarAppearsTransparent to YES means that the border thickness has to account
+ // for the title bar height as well, otherwise sheets will not be presented at the correct
+ // position, which should be (title bar height + top content border size).
+ const NSRect frameRect = window.frame;
+ const NSRect contentRect = [window contentRectForFrameRect:frameRect];
+ const CGFloat titlebarHeight = frameRect.size.height - contentRect.size.height;
+ effectiveTopContentBorderThickness += titlebarHeight;
+
[window setContentBorderThickness:effectiveTopContentBorderThickness forEdge:NSMaxYEdge];
[window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];