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>
This commit is contained in:
Morten Johan Sørvig 2020-04-28 10:52:01 +02:00
parent 084525a034
commit 562d7ded3b

View File

@ -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