Hi all
I would like to hide the header of a layer group in the print layout legend.
The code for the legend is as follows:
*        legend = QgsLayoutItemLegend(layout)*
*        legend.setAutoUpdateModel(False)*
*        root = legend.model().rootGroup()*
*        legend.setTitle(printLayout_title)*
*        legend.setLinkedMap(map)*
*        legend.setLegendFilterByMapEnabled(True)*
*        root = QgsLayerTree()*
*        for lyr in map.layersToRender():*
*            if lyr.providerType()!='wms' and lyr.name <http://lyr.name>()
not in hidden_layers:*
*                root.addLayer(lyr)*
*            legend.model().setRootGroup(root)*
*            layout.addItem(legend)*
*        legend.attemptMove(QgsLayoutPoint(235, 36,
QgsUnitTypes.LayoutMillimeters))*
Thanks in advance
Asim
_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to