[Qgis-developer] Better Menus for QGIS 1.0

Tom Elwertowski telwertowski at comcast.net
Thu Aug 14 16:25:04 EDT 2008


Tim Sutton wrote:
> - The plugin menu is something that always didnt feel right for me.
> The original idea when we implemented plugins 'way back when' was that
> plugins should integrate themselves into the existing menu structure.
> There were issues with doing it at the time and it got parked in the
> back lot and never revisited.

I'm in favor of allowing plugin menus and items to be placed anywhere.

The WFS plugin has one command which probably belongs on the Layer menu after the WMS item. Since menu insertion uses a 'before' argument, the code would look like:

qgisApp->layerMenu()->insert(
  qgisApp->actionLayerSeparator1(), actionAddWfsLayer);

GRASS provides a large set of commands and perhaps should have its own top-level menu. It would look like:

qgisApp->menuBar()->insertMenu( qgisApp->lastMenu()->menuAction(), menuGrass);

If a plugin has one command, the item should be directly in some menu or the Plugin menu by default. If it has a few commands, they should be in a Plugin menu submenu if not inserted elsewhere individually. If it has many commands, they should probably be a top-level menu.

One issue created by menu insertion, however, is that it depends upon the order in which plugins are loaded. For example, if two plugins are loaded which insert an "Add xyz Layer" item in the same place and then the first plugin is unloaded and later reloaded, the order of the two menu items will be reversed.

Perhaps this will be rare or perhaps not. In the future, the demand may arise for the ability to order the loading of plugins or even for users to customization where plugin items go. These issues can be addressed after QGIS 1.0.

Tom


More information about the Qgis-developer mailing list