Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix menus for 5754, 5753 and address feature request for 5516 #164

Closed
wants to merge 2 commits into from

Conversation

dakcarto
Copy link
Member

Info is in the commit messages. Commit 10fe387 should probably be reviewed by core developers, as it changes functionality of menus. No new strings added.

Commit f01c6ad only fixes the issue as far as QGIS src code is concerned. It doesn't keep plugins, that are added by user, from hijacking the About or Preferences... menu actions, under QGIS application menu on Mac. For example, CadTools and SEXTANTE hijack the About menu, if installed. The last plugin to load that has a QAction with a name that starts with 'about*' will be the winning hijacker. This is only if the plugin installs its own top-level menu in the menu bar; submenus are ignored by Qt for the Mac-only merge 'feature'.

To fix this last Mac-only issue, a function needs added that can be called whenever/wherever a plugin is added to a top-level menubar menu. It should check if any of the QActions added has a role of QAction::TextHeuristicRole and, if so, set it to QAction::NoRole, as all menu roles are already explicitly defined for AboutRole and PreferencesRole (in src/ui/qgisapp.ui). Any new QAction's menu role, excepting maybe in the future ApplicationSpecificRole, should not be allowed to heuristically hijack the QGIS.app's main application menu actions, just because their action's title starts with a particular text.

QAction::TextHeuristicRole is basically a bad idea and its functionality should be removed from Qt.

…ke a method that set all QAction additions to base menus (submenus ok) to QAction::NoRole. This would keep any new action from hijacking the Mac app's About or Preferences… menus.

See: http://doc.qt.nokia.com/4.7.1/qmenubar.html#qmenubar-on-mac-os-x
These small edits significantly change the ordering and function of the main menus. This standardizes menus to File, Edit, View, Layer, Vector, Raster, Database, Web, Settings, Plugins, [Plugin-added-menus], Window (on Mac), Help. The order chosen is for the following reasons.

Settings was moved after functional program menus. Settings precedes Plugins so that, if there are a lot of plugin-added menus, Settings (an important menu) is not pushed out of view. Having the OS-convention right menus of Window and/or Help possibly pushed out of view is less of an issue. Ideally, from now on, plugins should be adding themselves to standardized category menus.

Any plugin that 'needs' to add itself to the menubar should then use (here for Python):
menu_bar = self.iface.mainWindow().menuBar()
menu_bar.insertMenu( self.iface.firstRightStandardMenu().menuAction(), self.my_plugins_menu )

Ideally, a new QgisInterface public slot pair of addMenuToMenuBar(QMenu)/removeMenuFromMenuBar(QMenu) should be added, to help plugin developers put their menus in the correct place.
@dakcarto dakcarto closed this Jun 10, 2012
yjacolin pushed a commit to yjacolin/QGIS that referenced this pull request Oct 4, 2014
homogenize file naming in gentle gis introduction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant