[Qgis-user] Change of selected layer

Möri Cedric Cedric.Moeri at bd.so.ch
Thu Nov 6 08:15:52 PST 2008


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:cedric.moeri at bd.so.ch 

http://www.agi.so.ch



More information about the Qgis-user mailing list