Change how we define which menu items are included in the main menu on Mac OS X

This commit is contained in:
Jonathan Springer 2014-04-16 16:26:49 -04:00
parent f7a23737f2
commit aa6b756956

View File

@ -320,12 +320,12 @@ class Ui_MainWindow(object):
# i18n add Language Actions
add_actions(self.settings_language_menu, (self.auto_language_item, None))
add_actions(self.settings_language_menu, self.language_group.actions())
# Order things differently in OS X so that Preferences menu item in the
# app menu is correct (this gets picked up automatically by Qt).
# Qt on OS X look for keywords in the menu items title to determine which menu items get added to the main menu.
# If we are running on Mac OS X the menu items whose title contains those keywords but don't belong in the main
# menu need to be marked as such with QAction.NoRole.
if sys.platform == 'darwin':
add_actions(self.settings_menu, (self.settings_plugin_list_item, self.settings_language_menu.menuAction(),
None, self.settings_configure_item, self.settings_shortcuts_item, self.formatting_tag_item))
else:
self.settings_shortcuts_item.setMenuRole(QtGui.QAction.NoRole)
self.formatting_tag_item.setMenuRole(QtGui.QAction.NoRole)
add_actions(self.settings_menu, (self.settings_plugin_list_item, self.settings_language_menu.menuAction(),
None, self.formatting_tag_item, self.settings_shortcuts_item, self.settings_configure_item))
add_actions(self.tools_menu, (self.tools_add_tool_item, None))