Hi everyone,

I have connected the signal selectionChanged so some code, which is executed 
after features are selected.

myLayer.selectionChanged.connect(self.executeAfterSelection)

Then I have a method self. executeAfterSelection(self, featuresIds)

The SIGNAl/SLOT tandem works but now I realized every time when I call 
myLayer.selectionChanged.connect(self.executeAfterSelection)  It does not 
overwrite my previous call. It creates a second signa/slot tandem. During 
running the method  executeAfterSelection is excuted twice, three times etc.

How can I check if the SIGNAL selectionChanged is connected to the slot 
executeAfterSelection before I run 
myLayer.selectionChanged.connect(self.executeAfterSelection)?

I tried this:
receiversCount = QtCore.QObject.receivers(QtCore.SIGNAL("selectionChanged()")
receiversCount = QtCore.QObject.receivers(QtCore.SIGNAL("selectionChanged")
receiversCount = 
QtCore.QObject.receivers(QtCore.SIGNAL("myLayer.selectionChanged()")
receiversCount = 
QtCore.QObject.receivers(QtCore.SIGNAL("myLayer.selectionChanged")

Every time I get this error:

QObject.receivers(SIGNAL()): first argument of unbound method must have type 
'QObject').


Thanks,
Marian




________________________________

This electronic message, as well as any transmitted files included in the 
electronic message, may contain privileged or confidential information and is 
intended solely for the use of the individual(s) or entity to which it is 
addressed. If you have received this electronic message in error please notify 
the sender immediately and delete the electronic message. Any unauthorized 
copying, disclosure or distribution of the electronic message is strictly 
forbidden. NAV CANADA accepts no liability for any damage caused by any virus 
and/or other malicious code transmitted by this electronic communication.

Le pr?sent message ?lectronique et tout fichier qui peut y ?tre joint peuvent 
contenir des renseignements privil?gi?s ou confidentiels destin?s ? l'usage 
exclusif des personnes ou des organismes ? qui ils s'adressent. Si vous avez 
re?u ce message ?lectronique par erreur, veuillez en informer l'exp?diteur 
imm?diatement et supprimez le. Toute reproduction, divulgation ou distribution 
du pr?sent message ?lectronique est strictement interdite. NAV CANADA n'assume 
aucune responsabilit? en cas de dommage caus? par tout virus ou autre programme 
malveillant transmis par ce message ?lectronique.
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to