I appreciate it!<br><br>Regards<br><br><div class="gmail_quote">2011/6/20 kimaidou <span dir="ltr"><<a href="mailto:kimaidou@gmail.com">kimaidou@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Of course !<br><br>This is basically what I have done :<br><br><a href="http://pastebin.com/1yhyuRxA" target="_blank">http://pastebin.com/1yhyuRxA</a><br><br>Regards, </blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<font color="#888888">Kimaidou</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">2011/6/20 Germán Carrillo <span dir="ltr"><<a href="mailto:carrillo.german@gmail.com" target="_blank">carrillo.german@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Kimaidou, <br><br>may you share your solution? It may be useful for some people here (including myself). <br>
<br>Regards, <br>
<br>Germán<br><br><div class="gmail_quote"><div><div></div><div>2011/6/20 kimaidou <span dir="ltr"><<a href="mailto:kimaidou@gmail.com" target="_blank">kimaidou@gmail.com</a>></span><br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Hi all<br><br>I managed to reconstruct my legend in my QTreeWidget by using a dictionary to store the item I have already added in the tree while looping through groupLayerRelationship !<br>
<br>Cheers<br><font color="#888888">Kimaidou</font><div><div></div><div><br><br><div class="gmail_quote">
2011/6/20 kimaidou <span dir="ltr"><<a href="mailto:kimaidou@gmail.com" target="_blank">kimaidou@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi devs,<br>
<br>I am a bit stuck here....<br>I would like to recreate the complete legend tree inside a python plugin. I have chosen to use a QtreeWidget to do so.<br><br>Imagine I have:<br>*****************<br>group 0 (empty)<br>
<br>group 1<br>|-- group 11<br>
|-- layer 11a<br> |-- layer 11b<br>|-- layer 1a<br><br>layer a<br><br>group 2<br>|-- group 21<br>|-- layer 2a<br>***********************<br><br>I have seen the <br>
<p style="margin: 0px; text-indent: 0px;">iface.legendInterface().groupLayerRelationship()</p><p style="margin: 0px; text-indent: 0px;">returns usefull information, but in a flat "C-style" way like :</p><p style="margin: 0px; text-indent: 0px;">
<br></p>[<br> ['group 0', [] ], <br> ['group 1', ['group 11', 'layer_1a_10020100526085601790'] ], <br> ['', ['layer_a_20110617181245226'] ], <br> ['group 2', ['groupe21', 'layer_2a_20110616121558434'] ], <br>
['group 11', ['layer_11a_20100526085601799', 'layer_11b_gen20100526100356932'] ], <br> ['groupe21', []]<br>]<br><br><br>I would like to loop though this result and create my own hierarchical representation such as :<br>
[<br> 'name' : 'group 0' , 'type' : 'group', 'children' : [],<br> 'name' : 'group 1' , 'type' : 'group', 'children' : [<br> 'name' : 'group 11' , 'type' : 'group', 'children' : [<br>
'name' : 'layer 11a' , 'type' : 'layer', 'children' : [],<br> 'name' : 'layer 11b' , 'type' : 'layer', 'children' : []<br>
],<br> 'name' : 'layer 1a' , 'type' : 'layer', 'children' : []<br> ],<br> 'name' : 'layer a' , 'type' : 'layer', 'children' : [],<br>
'name' : 'group 2' , 'type' : 'group', 'children' : [<br> 'name' : 'group 21' , 'type' : 'group', 'children' : [],<br> 'name' : 'layer 2a' , 'type' : 'layer', 'children' : []<br>
]<br>]<br><br>I have tried hard since yesterday, but have not succeeded... Has anyone already encoutered this need ? <br><br>Thanks in advance, <br><font color="#888888">kimaidou<br>
</font></blockquote></div><br>
</div></div><br></div></div>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br></blockquote></div><font color="#888888"><br>-- <br>-----------<br> |\__ <br>(:>__)(<br> |/ <br><br>Soluciones Geoinformáticas Libres <br><a href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><br>
</font></blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-----------<br> |\__ <br>(:>__)(<br> |/ <br><br>Soluciones Geoinformáticas Libres <br><a href="http://geotux.tuxfamily.org/">http://geotux.tuxfamily.org/</a><br>