[Qgis-user] Nested group in python

Alexia Mondot alexia.mondot at c-s.fr
Wed May 15 02:41:52 PDT 2013


I work on qgis 1.9 and in the API, there is :

> virtual int addGroup 
> <http://www.qgis.org/api/classQgsLegendInterface.html#a25a8cf67b140383bab0c75e90a3eb3f8> 
> (QString name, bool expand=true, QTreeWidgetItem *parent=0)=0
I've run this function in Python, and it works for me.

You can try :
> li = qgis.utils.iface.legendInterface()
> g1 = li.addGroup("g1")
> g2 = li.addGroup("g2",True, g2)


On 05/15/2013 09:25 AM, David J. Bakeman wrote:
> On 05/14/2013 03:02 PM, David J. Bakeman wrote:
>> On 05/14/2013 02:56 PM, Etienne Tourigny wrote:
>>>
>>> On Tue, May 14, 2013 at 6:21 PM, David J. Bakeman
>>> <dbakeman at comcast.net <mailto:dbakeman at comcast.net>> wrote:
>>>
>>>      Is it possible to create a group within a group in python?
>>>
>>>      li = qgis.utils.iface.legendInterface()
>>>      g1 = li.addGroup("g1")
>>>      g2 = li.addGroup("g2",g2)
>>>
>>>
>>> did you try this?
>>>
>>> g2 = li.addGroup("g2", g1)
>> Sorry for the typo yes that is exactly what I tried.  Does it work for
>> you?
> I built master from source and it doesn't work there either.
>
> P.S. I think this response is in plain text so shouldn't get rejected.
>>>
>>>
>>>      The above seems like it should work but it doesn't.
>>>
>>>      Thanks.
>>>
>>>      _______________________________________________
>>>      Qgis-user mailing list
>>>      Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>>>      http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>>>
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130515/78a7615a/attachment.html>


More information about the Qgis-user mailing list