macOS: Disable minimize button for Qt::Dialog windows by default

Regression after 4c78ef80ca7573cd2eb054cdf1667837b43e6c58, where
we moved the window titlebar button logic from QCocoaWindow's
windowStyleMask function to updateTitleBarButtons.

Fixes: QTBUG-114064
Change-Id: Idb0870571e88fa2962af36decd9bc7b53c35664d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0ab091c92f1d214ebee01e9e26725e15497bdd53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2023-06-02 13:42:02 +02:00 committed by Qt Cherry-pick Bot
parent 492aafd8a7
commit c66cad7ccf

View File

@ -553,10 +553,17 @@ void QCocoaWindow::updateTitleBarButtons(Qt::WindowFlags windowFlags)
bool hideButtons = true;
for (const auto &[button, buttonHint] : buttons) {
// Set up Qt defaults based on window type
bool enabled = true;
if (button == NSWindowMiniaturizeButton)
enabled = window()->type() != Qt::Dialog;
// Let users override via CustomizeWindowHint
if (windowFlags & Qt::CustomizeWindowHint)
enabled = windowFlags & buttonHint;
// Then do some final sanitizations
if (button == NSWindowZoomButton && isFixedSize())
enabled = false;