Set NoRole menu role on toggle fullscreen action

Again, since the default menu role is TextHeuristicRole, and when we
enter fullscreen the text is set to "Exit Full Screen", the Mac QPA
menu item syncing will assign this to be the quit menu item.

This would cause two problems. First, pressing Cmd-Q in fullscreen would leave
fullscreen mode instead of quitting the app. Second, that would make the quit
menu item to be hidden when leaving fullscreen, since the toggle fullscreen
action text would change back to "Enter Full Screen", and the make a round
trip to the menu item heuristic logic.

Task-number: QTBUG-30654
Change-Id: I7524c54c3bd77cce891c57292825f02e163fd7fa
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Gabriel de Dietrich
2013-04-19 16:05:50 +02:00
committed by Eike Ziller
parent cf2b3f2e61
commit 79428126e4

View File

@@ -753,6 +753,7 @@ void MainWindow::registerDefaultActions()
if (supportsFullScreen) {
// Full Screen Action
m_toggleFullScreenAction = new QAction(fullScreenActionText, this);
m_toggleFullScreenAction->setMenuRole(QAction::NoRole);
m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));