[Qgis-user] Printing Qgis shown layers in new version

Ludwig Kniprath ludwig at kni-online.de
Fri Dec 8 14:10:59 PST 2023


Hi Asim,

I'm surprised that previous QGis versions should have returned three 
layers "Gasunie 2, Gasunie Z-509-05 and Wattinfra Kabelverbinding", 
because the legend image shows a single vector layer "Overzicht 
entities" with three classes, not three separate layers.

According to https://api.qgis.org/api/classQgsProject.html:

QgsProject.instance().mapLayers() => "Returns a map of all registered 
layers by layer ID."

Perhaps you previously had three separate layers bundled in a layer group?

Ludwig


Am 08.12.23 um 15:47 schrieb Asim al-sofi via QGIS-User:
> Hi All,
> I have a question related to printing out the shown layers in qgis.
> I made a plugin that has worked fine in the older Qgis versions but 
> not working properly in the new version.
> The problem that iam facing is that the 
> *QgsProject.instance().mapLayers().values() *does not show me the 
> layers shown in qgis.
> So in the previous version, the below image gives me the names of the 
> layers *Gasunie 2, Gasunie Z-509-05 and Wattinfra Kabelverbinding*. 
> But in the new Qgis version it gives me the names *Overzicht entities 
> and openbasiskaart.nl <http://openbasiskaart.nl>*. Does anyone know 
> how to tackle this problem?
> Layers.png
> Thanks in advance
> Kind regards
> Asim
>
> _______________________________________________
> QGIS-User mailing list
> QGIS-User at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20231208/932dd6a8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Layers.png
Type: image/png
Size: 6612 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20231208/932dd6a8/attachment.png>


More information about the QGIS-User mailing list