OS X: Add action for closing external windows

E.g. editor windows and help windows. There is no automatic system
shortcut for this on OS X.

Change-Id: I27f1208cde0a6f4b1a6952a7988d00a8481a08a4
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Eike Ziller
2014-07-18 10:35:17 +02:00
parent febdfeb92f
commit 7dfb7df471
4 changed files with 25 additions and 1 deletions

View File

@@ -61,6 +61,10 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context)
m_zoomAction = new QAction(this);
ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context);
connect(m_zoomAction, SIGNAL(triggered()), m_window, SLOT(showMaximized()));
m_closeAction = new QAction(this);
ActionManager::registerAction(m_closeAction, Constants::CLOSE_WINDOW, context);
connect(m_closeAction, SIGNAL(triggered()), m_window, SLOT(close()), Qt::QueuedConnection);
}
m_toggleFullScreenAction = new QAction(this);
@@ -74,6 +78,12 @@ WindowSupport::~WindowSupport()
ICore::removeContextObject(m_contextObject);
}
void WindowSupport::setCloseActionEnabled(bool enabled)
{
if (UseMacShortcuts)
m_closeAction->setEnabled(enabled);
}
bool WindowSupport::eventFilter(QObject *obj, QEvent *event)
{
if (obj != m_window)