Nobody said he wasn't :) Please also modify the last Python line in the "Removing nodes" section from [1].
Instead of: QgsMapLayerRegistry.instance().addMapLayer(layer1) It should be: QgsMapLayerRegistry.instance().removeMapLayers([layer1.id()]) Thanks for your work! Regards, Germán --- [1] http://www.lutraconsulting.co.uk/blog/2014/07/25/qgis-layer-tree-api-part-2/ 2014-12-21 8:55 GMT-05:00 Martin Dobias <[email protected]>: > Hi > > On Thu, Dec 18, 2014 at 9:50 PM, Germán Carrillo < > [email protected]> wrote: >> >> Thank you Luigi. >> >> So, I guess the following code would be enough to make the example given >> in [1] much more generic: >> >> ####### >> cloned_group1 = node_group1.clone() >> root.insertChildNode(0, cloned_group1) >> >> parent = node_group1.parent() # new code >> >> parent.removeChildNode(node_group1) # replace root by parent >> ####### >> > > Luigi is right - you need to call removeChildNode() on the parent node. > When I will find some time I will add a note to the example. > > Cheers > Martin > > -- ----------- |\__ (:>__)( |/ Soluciones Geoinformáticas Libres http://geotux.tuxfamily.org/ http://twitter.com/GeoTux2
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
