AW: Re: AW: [Qgis-user] How to get group index ?

Kris Nackaerts knackaerts at gmx.net
Fri Feb 4 03:05:49 PST 2011


Thank's,

>From version 1.6 the function groupLayerRelationship() is available. It also seems to work for nested groups, cfr. output:

(group2 is nested in group)

[PyQt4.QtCore.QString(u''), [PyQt4.QtCore.QString(u'207523351120110204115934531')]]
[PyQt4.QtCore.QString(u'group'), [PyQt4.QtCore.QString(u'group2')]]
[PyQt4.QtCore.QString(u'group2'), []]


-------- Original-Nachricht --------
> Datum: Thu, 3 Feb 2011 20:46:18 +0100
> Von: Ziegler Stefan <Stefan.Ziegler at bd.so.ch>
> An: knackaerts <knackaerts at gmx.net>
> CC: qgis-user <qgis-user at lists.osgeo.org>
> Betreff: AW: Re: AW: [Qgis-user] How to get group index ?

> The python bindings for this method was introduced with revision 14164.
> So you should try QGIS 1.6 I guess.
> 
> regards
> Stefan
> 
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Kris Nackaerts [mailto:knackaerts at gmx.net]
> > Gesendet am: Donnerstag, 3. Februar 2011 20:38
> > An: Ziegler Stefan
> > Betreff: Re: AW: [Qgis-user] How to get group index ?
> > 
> > I'm using version 1.4 on Ubuntu 10.x at the moment.
> > 
> > I did a dir(iface.legendInterface()) and 
> > groupLayerRelationship() is not 
> > in it.
> > 
> > the indexOf() function returns the index of the group in the 
> > list of all 
> > groups, but that's not the correct index for the legend.
> > 
> > On which version do you use it?
> > Kris
> > 
> > 
> > On 03/02/2011 17:40, Ziegler Stefan wrote:
> > > 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"<knackaerts at gmx.net>
> > > Gesendet: Don, 3.2.2011 17:29
> > > An: qgis-user at lists.osgeo.org
> > > 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
> 
> 

-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail



More information about the Qgis-user mailing list