[Qgis-developer] Detect raster layers which have been deleted

Denis Rouzaud denis.rouzaud at gmail.com
Sun Dec 15 22:49:28 PST 2013

Hi Etienne,

On 14. 12. 13 16:38, Etienne Trimaille wrote:
> Hi,
> Sorry, I'm a beginner in pyqgis.
> I found the signal "layerDeleted ()" in the QgsVectorLayer class,
> however, I can't find it in the QgsRasterLayer class :
> http://qgis.org/api/2.0/classQgsVectorLayer.html#acc3e594b1dac4815dc031a2236f66a96
> Is there a reason ?
I don't know why there is no equivalent for raster layers.
> How can I detect that a raster layer has been deleted ?
But to solve your problem, you can use layer(s)Removed signals in the 
layer registry.

you would use:

QgsMapLayerRegistry.instance().layer(s)Removed.connect(this, yourSlot)

Then in your slot, check if the delete layer(s) is the good one.
> Another question :
> I didn't find a way to insert a layer at the bottom, not on the top.
> I want to change the drawing order for a new layer.
Sorry, I had a quick look, and couldn't find how to do this.
Have to wait for someone else to answer!



> Thanks
> Regards,
> Etienne
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the Qgis-developer mailing list