I made a template that allows to quickly export a map. For layers groups, i can disabling showing it on legend and symbol stay displayed on the map :
I would like to make the same for layers but it doesn't work. The legend entry is always visible. The check option "hidden" is well checked in QGIS Composer (bug ?). I've try an other approach with the legend model and i remove the current node :
child = ... model = legend.model() index = model.node2index(child) model.removeRow(index.row(), index.parent())
However, the layer is removed from the main ToC.
Is there a solution to keep the layer in the main ToC and remove the entry (but not the symbol) in a layout in PyQGIS ?