Hi Kris

this solution should still work (at least for me). Which version of QGIS do you 
use?

regards
Stefan

Mit freundlichem Gruss
Stefan Ziegler
Leiter amtliche Vermessung

Amt für Geoinformation
Rötistrasse 4
4501 Solothurn
032 627 75 96 

----- Originalnachricht -----
Von: "Kris Nackaerts" <[email protected]>
Gesendet: Don, 3.2.2011 17:29
An: [email protected]
Betreff: [Qgis-user] How to get group index ?

Dear,

I'm trying to get the correct group index from python so I can move layers into 
a predefined group. I can get the list of groups, but not the correct index in 
the full legend tree. Anyone who knows how to get this?

I found one solution, but this is not working anymore:
http://code.google.com/p/cataisrepository/source/browse/trunk/qgis/plugins/soverify/tools/utils.py?spec=svn89&r=89

It uses relationList = iface.legendInterface().groupLayerRelationship()
, a function that doesn't exist.



my trial was:
        if 'Templates' in legend.groups():
            g_templates = legend.groups().indexOf('Templates') 
        else:
            g_templates=legend.addGroup('Templates')
        legend.moveLayer(loadedLayer,g_templates)

Any hints?

Kris
-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit 
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to