[Qgis-developer] Re: Python plugin menu questions

Yves Bolognini yves.bolognini at camptocamp.com
Fri Mar 19 06:42:50 EDT 2010


Just a small update about how to disable menus in Python plugins.

> 1) Remove/hide an entire menu, like the Edit menu

One solution:

menubar = self.iface.editMenu().parentWidget()
actions = menubar.actions()
menubar.removeAction(actions[1])

> 2) Remove/hide the contextual menu entries "Show Overview" (contextual
> toolbar menu) and "Add to Overview" (contextual layer menu). Actually
> I need to completely disable the overview, so it includes removing
> these menu entries

It seems that's not possible. Contextual layer menu is created
dynamically in app/legend/qgslegend.cpp when a right-click occurs. So
we don't have access to it in plugins.

Regards,
Yves


More information about the Qgis-developer mailing list