[Qgis-developer] currentLayerChanged signal
motta.luiz at gmail.com
motta.luiz at gmail.com
Fri Feb 19 07:25:56 EST 2010
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