[Qgis-developer] Python: groups in QgsLegendInterface()

Marco Bernasocchi marco at bernawebdesign.ch
Fri Jun 10 03:57:33 EDT 2011


Hi Chris,
On 06/10/2011 04:05 AM, Chris Crook wrote:
> Hi All
>
> How can I determine the group index of a group containing a layer?

  have  a look at [0] it is the data loader for my temporal data plugin, It
     generates new groups and adds layers programmatically. Please note that
     it is not possible [yet] to nest groups deeper than a level due to the
     legend model.

> Basically I'm creating a new layer, and wanting to add it to the same group as a new layer. It looks like the only way to add a layer to a group is via the group index.  But I can't see any way to determine the group index of an existing layer.
>
> The nearest I've got is
>
>    [i for i,x in enumerate(legend.groupLayerRelationship()) if layer.id() in x[1]]
>
> But this doesn't work with nested groups.
>
> Any other suggestions?
>
> Thanks
> Chris
> ______________________________________________________________________________________________________
>
> This message contains information, which is confidential and may be subject to legal privilege.
> If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
> If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message.
> LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.
>
> Thank you.
> ______________________________________________________________________________________________________
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

  Ciao
  Marco
  [0]http://hub.qgis.org/projects/multiview/repository/revisions/master/entry/temporalrasterloaderdialog.py




More information about the Qgis-developer mailing list