[Qgis-developer] Remove layer from layer tree without destroying the layer

Casper Børgesen (CABO) CABO at NIRAS.DK
Mon Aug 22 04:57:19 PDT 2016


I have added a layer to the layer tree and now I want to remove it from the layer tree:

self.layer = self.create_my_layer()

QgsProject.instance().layerTreeRoot().insertLayer(0, self.layer)

QgsProject.instance().layerTreeRoot().removeLayer(self.layer)

But it seems like my layer has been destroyed while removing it from the layer tree. Is it possible to not destroy the layer while still removing it from the tree?


Regards, Casper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160822/bf31182b/attachment.html>


More information about the Qgis-developer mailing list