macOS: Zoom action should "unmaximize" if already maximized

Task-number: QTCREATORBUG-24495
Change-Id: I94273f6aa9b425b57e328cfdb052dc171718a97e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2020-08-18 10:32:11 +02:00
parent 0a3f193d1e
commit f0f1775fd5

View File

@@ -67,7 +67,16 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context)
m_zoomAction = new QAction(this); m_zoomAction = new QAction(this);
ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context); ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context);
connect(m_zoomAction, &QAction::triggered, m_window, &QWidget::showMaximized); connect(m_zoomAction, &QAction::triggered, m_window, [this] {
if (m_window->isMaximized()) {
// similar to QWidget::showMaximized
m_window->ensurePolished();
m_window->setWindowState(m_window->windowState() & ~Qt::WindowMaximized);
m_window->setVisible(true);
} else {
m_window->showMaximized();
}
});
m_closeAction = new QAction(this); m_closeAction = new QAction(this);
ActionManager::registerAction(m_closeAction, Constants::CLOSE_WINDOW, context); ActionManager::registerAction(m_closeAction, Constants::CLOSE_WINDOW, context);