i'm making some experiments with the SelectionChanged signal of a QgsVectorLayer.

i try this piece of code :


and "test" print a warning message.

The probleme i have is that the signal is triggered every time i click on the layer, even when there's no change of selection ...

Is there something i'm missing in this SelectionChanged behaviour ?

Thanks for your help.


Ok then, after a few searches :

U got to use the two lists provided by the SelectionChanged signal :

QgsFeatureIds selected,QgsFeatureIds deselected (as mentionned in the API doc...)

to check what is really changing in your selection, of course multiple features selection is to take in account ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.