macOS: Don't hide NSWindowZoomButton when window can go into fullscreen

The button in the title bar is used both for going into full screen and
maximizing (zooming) the window. We can't hide/disable it unless both
Qt::WindowFullscreenButtonHint and Qt::WindowMaximizeButtonHint are
off.

This means that when Qt::WindowMaximizeButtonHint is off, it's still
going to be possible to Option-click the button to maximize the
window, but this is less of a concern than hiding the full screen
button when Qt::WindowFullscreenButtonHint is set.

Change-Id: I70dbe27b3197fe22c1781277f8bf9a818d71d04d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-02-03 18:46:27 +01:00
parent 1e7143cff8
commit 666b91fb8f

View File

@ -930,7 +930,8 @@ void QCocoaWindow::setWindowZoomButton(Qt::WindowFlags flags)
// in line with the platform style guidelines.
bool fixedSizeNoZoom = (windowMinimumSize().isValid() && windowMaximumSize().isValid()
&& windowMinimumSize() == windowMaximumSize());
bool customizeNoZoom = ((flags & Qt::CustomizeWindowHint) && !(flags & Qt::WindowMaximizeButtonHint));
bool customizeNoZoom = ((flags & Qt::CustomizeWindowHint)
&& !(flags & (Qt::WindowMaximizeButtonHint | Qt::WindowFullscreenButtonHint)));
[[m_nsWindow standardWindowButton:NSWindowZoomButton] setEnabled:!(fixedSizeNoZoom || customizeNoZoom)];
}