How to remove a QgsMapCanvasLayer from QgsMapCanvas with PyQGIS || C++?

المشرف العام

Administrator
طاقم الإدارة
I try to find a way to remove a QgsMapCanvasLayer from the QgsMapCanvas. At the moment I only can delete the MapLayer from the QgsMapLayerRegistry with:
QgsMapRegistry::instance()->removeMapLayer(LayerID);

The MapLayer vanishes from the QgsMapCanvas, but: macanvas->layerCount();results in the same amount as before. My Question is:Do I have to create a new/updated QList as layerSet in order to the updated QgsMapLayerRegistry, or is there a method to remove the deleted QgsMapLayer directly from the QgsMapCanvasOr maybe an easier question. Can I cast QList to QList? Or do I understand the concept wrong? Kindly, olleonkel



أكثر...
 
أعلى