diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-04-28 10:52:01 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-04-28 11:32:14 +0200 |
commit | 562d7ded3b23f7aa92cbe4f3132bec0053ed7163 (patch) | |
tree | 015cdaf67a7904b50f8501ce667e8c65be7938a3 /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | 084525a034fa9306247eec2005fa9e8279753829 (diff) |
macOS: draw toolbar separator line in unfifed mode
Commit 836a2fb8 changed the contentBorderThickness
property to also include the title bar height, in
order to position sheets correctly when unified toolbar
mode is enabled. As an accidental side effect this made
Qt stop drawing the toolbar separator line.
Account for the added title bar height also in
testContentBorderAreaPosition().
Task-number: QTBUG-78110
Change-Id: I4ecfd010a6784bbb592646affc676d8cbfd9b6da
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 79dfe58a4e..2cbdb3c873 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1815,8 +1815,17 @@ void QCocoaWindow::updateNSToolbar() bool QCocoaWindow::testContentBorderAreaPosition(int position) const { - return isContentView() && m_drawContentBorderGradient && - 0 <= position && position < [m_view.window contentBorderThicknessForEdge:NSMaxYEdge]; + if (!m_drawContentBorderGradient || !isContentView()) + return false; + + // Determine if the given y postion (relative to the content area) is inside the + // unified toolbar area. Note that the value returned by contentBorderThicknessForEdge + // includes the title bar height; subtract it. + const int contentBorderThickness = [m_view.window contentBorderThicknessForEdge:NSMaxYEdge]; + const NSRect frameRect = m_view.window.frame; + const NSRect contentRect = [m_view.window contentRectForFrameRect:frameRect]; + const CGFloat titlebarHeight = frameRect.size.height - contentRect.size.height; + return 0 <= position && position < (contentBorderThickness - titlebarHeight); } qreal QCocoaWindow::devicePixelRatio() const |