[Qgis-developer] index in self.legend.groupLayerRelationship - different behavior between QGIS 1.8 and master?

kimaidou kimaidou at gmail.com
Thu Oct 4 08:17:04 PDT 2012


Hi massimo,

You are right, we must add a id for each group in Qgis. For now, the group
is defined only with its name, which leads to this kind of behaviour. At
the contrary, layers do have an id in Qgis, so you can use the same name
for 2 different layers.

I think we must enhance a bit the way how groups are handled and provide
appropriate public methods like
group->id(), ĝetGroup(id), etc.

In the lizmap example, I could only use  QgsLegendInterface::groups  wich
returns a string list of groups, and groupLayerRelationship which provide a
flat list of groups and layers. The latter returns ids of layers, but name
of groups, so there is no easy way to distinguish to groups with the same
name.

Michael

2012/10/4 Massimo <massimo.endrighi at geopartner.it>

> Michael,
>
> thank you for the tip but your code fails under some circumstances. See
> attached image.
> <http://osgeo-org.1560.n6.nabble.com/file/n5006430/lizmap_error.png>
>
> If you think that you can fix it I will be happy to adopt your algorithm,
> otherwise we can find a solution adding something to QGis API.
>
> Regards
> Massimo
>
>
> kimaidou wrote
> > Hi all,
> >
> > In Lizmap plugin, I need to display the layer and group tree. You can
> find
> > some code here :
> > https://bitbucket.org/mdouchin/lizmapplugin/src/9cdfa856b8f0/lizmap.py
> > Line 451 : populateLayerTree
> >
> > There is some specific lizmap code in there, but you can probably use
> some
> > of it.
> >
> > Michael
>
>
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/index-in-self-legend-groupLayerRelationship-different-behavior-between-QGIS-1-8-and-master-tp5004337p5006430.html
> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20121004/9b033bf0/attachment.html>


More information about the Qgis-developer mailing list