diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-09-28 17:37:58 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-10-08 10:38:37 +0000 |
commit | 836a2fb8872217d2a04a209b89f2ac2ff86a4b99 (patch) | |
tree | c913ce8fbedce83c24c0e4d2351f5dad84a820ce /src/testlib/qxctestlogger.mm | |
parent | 7146c9075c85cb46cb38b57ded3e12dfa6cbef66 (diff) |
[macOS] Fix position of sheets when using unifiedTitleAndToolBarOnMac
Modal sheets are supposed to appear below the toolbar if a toolbar
exists, or below the title bar if a toolbar doesn't exist.
In the unified title and toolbar mode, sheets should to appear
directly below the toolbar, if the toolbar is positioned at the
top of the window.
Code-wise we achieve that by calling setUnifiedTitleAndToolBarOnMac on
a QMainWindow, which results in adjusting the top content border of
the NSWindow via [NSWindow setContentBorderThickness:forEdge], which
Cocoa uses to position a modal sheet (the sheet top edge is aligned
with the top edge of the content view + the Y border thickness
value).
The issue is that because NSWindow.titlebarAppearsTransparent is set
to YES, for sheet presentation purposes, Cocoa considers the content
view to begin at the position of the top left corner of the
frame (where the title bar is), and thus sheets appear somewhere
in the middle of the unified toolbar.
To fix that we need to account for the title bar height in the
border thickness value.
Compute the title bar height from the window frame height - window
content view height, and add it to the top border thickness value.
Amends 8ac9addd946637401e4685c6e91d1a3cd5b2d768
Change-Id: Icf85c513035cc3710b438e60eb14dc04c5bbaced
Fixes: QTBUG-65451
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/testlib/qxctestlogger.mm')
0 files changed, 0 insertions, 0 deletions