[Qgis-developer] Re: Python plugin menu questions
Marco Hugentobler
marco at hugis.net
Tue Mar 23 04:41:45 EDT 2010
Hi Yves
You are right, QMenu::setVisible has no effect.
A simpler solution might be:
menubar = self.iface.editMenu().parentWidget()
menubar.removeAction(self.iface.editMenu().menuAction())
Like this, you don't depend on the menu position (that is not guaranteed to be
fixed).
Regards,
Marco
Am Freitag, 19. März 2010 11.42:50 schrieb Yves Bolognini:
> 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
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
--
Dr. Marco Hugentobler
HUGIS GmbH
Webereistrasse 66
CH-8134 Adliswil
marco at hugis.net
http://homepage.hispeed.ch/hugis
Technical Advisor QGIS Project Steering Committee
More information about the Qgis-developer
mailing list