[Qgis-developer] QgsMapLayerRegistry [partially solved]

Michele Mammini mamminim at yahoo.it
Thu Oct 8 10:20:03 EDT 2009


Like in the subject I solved a part of my problem.

The correct code to remove the layer from QGis is:
      currentLayer = self.iface.activeLayer()
      RegIns = QgsMapLayerRegistry.instance()
      RegIns.removeMapLayer(currentLayer.getLayerID())

but it working if i use it in Python Console, while QGis crash if I 
use it in my plugin code




Dear All,

i have a problem with QgsMapLayerRegistry class when i try to remove 
a Layer from QGis.

i use this two code line:
      RegIns = QgsMapLayerRegistry.instance()
      RegIns.removeMapLayer(layerName)

where layerName is set with this command line: layerName = 
self.iface.activeLayer().name()

Do someone know how to solve it?

Thank you Michele.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20091008/ba6d4d16/attachment.html


More information about the Qgis-developer mailing list