[Qgis-user] Qgis Python plig-in. How can I change the nesting of groups?

Bernhard.Stroebl at jena.de Bernhard.Stroebl at jena.de
Wed Apr 20 06:53:50 PDT 2011


Hi Marco,

thank you for your answer. Your code is exactly how I expected the 
addGroup slot should work. I will check in the next couple of days if 
the patch has been applied.

thanks again

Bernhard

Am 20.04.2011 14:05, schrieb Marco Bernasocchi:
> Hi Bernhard, I just wrote a patch for trunk to make this functionality
> available to python. it has not been applied yet [1] but it probably
> will soon.
> after that, you need to do the following (please note that nesting as
> well as deleting nested groups is only supported at top level groups for
> now):
>
> legend = self.iface.legendInterface()
> pG = legend.addGroup("parent", False )
> c1 = legend.addGroup("child", False, pG )
> c2 = legend.addGroup("child", False, pG )
>
> legend.addGroup("child", False, c2 ) #this creates a top level group
> since multiple nesting is not supported yet
>
> I hope it helps
> ciao
> MArco
>
>
> [1] https://trac.osgeo.org/qgis/ticket/3263
>
> On 04/19/2011 07:34 AM, Bernhard.Stroebl at jena.de wrote:
>> Dear Marco (or anybody),
>>
>> sorry to pick up this thread again. Could you give an example on how to
>> use QgsLegendInterface.addGroup() with a parent?
>> If I want my new Group to be nested in let's say "GroupA" I would need
>> GroupA's QTreeWidgetItem. How can I access it in the first place?
>>
>> regards
>>
>> Bernhard
>>
>>
>> on April 5th you wrote:
>>> In 1.6 is not possible yet, i patched trunk 2-3 weeks ago. Now when
>>> you create a new group you can pass a parent element Where the group
>>> will be nested.
>>> Hope it helps
>>> Ciao
>>
>>> Marco Bernasocchi (mobile)
>>
>>
>>
>> ________ Information from NOD32 ________
>> This message was checked by NOD32 Antivirus System for Linux Mail Server.
>> http://www.nod32.com
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>



________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com



More information about the Qgis-user mailing list