[Qgis-developer] QgsMapLayerRegistry [partially solved]

Germán Carrillo carrillo.german at gmail.com
Thu Oct 8 12:21:01 EDT 2009


Hi Michele.

I guess you must update the canvas layer set after remove a layer from
QgsMapLayerRegistry.


Germán Carrillo


2009/10/8 Michele Mammini <mamminim at yahoo.it>

>  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.
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
> --
-----------
  |\__
(:>__)(
  |/

Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20091008/cb70b9f4/attachment.html


More information about the Qgis-developer mailing list