[Qgis-developer] Customize QAction in legend menu... howto?

Gino Pirelli luipir at gmail.com
Sun Dec 15 07:12:11 PST 2013


I can't find a python solution how to customize actions shown in the legend
menu opende using right click button

QAction registered in the QgsLegend can be retrieved using method:

QList< LegendLayerAction >QgsLegend::legendLayerActions(
QgsMapLayer::LayerType type ) const;

and the I can use iface.legendInterface().removeLegendLayerAction(QAction)

but this method is not available in QgsLegendInterface.

Other way is to get QAction that is listed in iface.action* and then
use removeLegendLayerAction, but not all QAction seems available in iface
and none in legendInterface(). e.g How to remove "Remove" QAction in this
iface.actionRemoveLayer() refer only to "Remove layer" QAction in layer

could be useful add QgsLegend::legendLayerActions to api to allow deep

thanks, Luigi Pirelli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131215/b0a65d6c/attachment.html>

More information about the Qgis-developer mailing list