[Qgis-user] Change of selected layer
Hi I currently try to programm a phyton plugin. Now I have to take some action if the layer in the legend changes, i.e the the current layer changes. I found the signal selectionChanged (QgsMapLayer *layer) of the QgsMapCanvas class and guessed, this might do the trick, but the docs says only Emit map tool changed event which it also says for the mapToolSet (QgsMapTool *tool). So theres some typo or something. My questions: Is the selectionChanged signal emited when the user changes his selection in the legend? If yes, how do I get it? I tried it with QObject.connect(self.iface.mapCanvas(), SIGNAL(selectionChanged (QgsMapLayer *layer)), self.test) in the initGui() but didn't succeed. Is there another way that my plugin gets informed if the current/selected layer changes? Thanks for any advice and best regards Cédric mit freundlichen Grüssen Cédric Möri GIS-Informatiker -- Kanton Solothurn Bau- und Justizdepartement Amt für Geoinformation Rötistrasse 4 4501 Solothurn Telefon +41 (0)32 627 24 75 Telefax +41 (0)32 627 22 14 mailto:[EMAIL PROTECTED] http://www.agi.so.ch ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Change of selected layer
Möri, Hi I currently try to programm a phyton plugin. Now I have to take some action if the layer in the legend changes, i.e the the current layer changes. I found the signal selectionChanged (QgsMapLayer *layer) of the QgsMapCanvas class and guessed, this might do the trick, but the docs says only Emit map tool changed event which it also says for the mapToolSet (QgsMapTool *tool). So theres some typo or something. My questions: Is the selectionChanged signal emited when the user changes his selection in the legend? If yes, how do I get it? I tried it with QObject.connect(self.iface.mapCanvas(), SIGNAL(selectionChanged (QgsMapLayer *layer)), self.test) try: QObject.connect(self.iface.mapCanvas(), SIGNAL(selectionChanged(QgsMapLayer)), self.test) you don't want to have the *layer, and you don't want a space between selectionChanged and ( However, I think selectionChanged refers to feature selection, such that it emits a signal with the mapLayer who's selection has changed... I could be reading that wrong though... C ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user