Is there a way to hide a layer name in the composer legend using pyqgis as we do from the legend properties (see picture)?
The only way I've found so far is by changing the layer name in the composer legend but it will also change it in the Layers list and I don't want that.
This is the code I used:
itemLlegend = composition.getComposerItemById('Legend')
modelindex=itemLlegend.modelV2().index(0, 0)
itemLlegend.modelV2().setFlag(QgsLayerTreeModel.AllowNodeRename)
itemLlegend.modelV2().setData(modelindex,'')
itemLlegend.updateLegend()
Any idea?