[Qgis-developer] currentLayerChanged signal

Michele Mammini mamminim at yahoo.it
Mon Feb 22 04:22:09 EST 2010


My problem is to catch the signal when the user change the selection 
of a layer in the legend.
The signal you suggest are only for adding/removing layer.

At moment i'm using the Kore version (1.0.2) of QGis.

Michele.

At 13:25 19/02/2010, motta.luiz at gmail.com wrote:
>Michele,
>
>a) See the signals in Mapcanvas API
>http://doc.qgis.org/head/classQgsMapCanvas.html
>layersChanged ()
>
>
>b) May be you need the theses SIGNALS:
>layerWillBeRemoved(QString)
>layerWasAdded(QgsMapLayer *)
>See in http://doc.qgis.org/head/classQgsMapLayerRegistry.html
>
>
>Example in tools (plugin downloads):
>a) C:\Documents and 
>Settings\lmotta\.qgis\python\plugins\GdalTools\tools\doTranslate.py
>self.connect(self.canvas, SIGNAL("layersChanged()"), self.fillInputLayerCombo)
>
>
>b) C:\Documents and 
>Settings\lmotta\.qgis\python\plugins\imgshowhide\imgshowhidewidget.py
>QtCore.QObject.connect(core.QgsMapLayerRegistry.instance(), 
>QtCore.SIGNAL("layerWillBeRemoved(QString)"), self.__removeLayer)
>QtCore.QObject.connect(core.QgsMapLayerRegistry.instance(), 
>QtCore.SIGNAL("layerWasAdded(QgsMapLayer *)"), self.__addLayer)
>
>
>Michele Mammini escreveu:
>>Dear all,
>>
>>in my python plugin i have to catch the currentLayerChanged to 
>>enabled/disable a button in the toolbar, but i don't know where and 
>>how write the signal connect to it.
>>I suppose that the signal must be write in the main plugin file...
>>
>>May someone can suggest me the correct procedure?
>>
>>Thanks, Michele.
>>
>>_______________________________________________
>>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