[Qgis-user] Hide header of layer group in print layout legend
Asim al-sofi
asim56 at gmail.com
Fri Nov 8 12:35:56 PST 2024
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20241108/fb976bbf/attachment.htm>
More information about the QGIS-User
mailing list