Hi Marian, Just tell Qt that it shouldn't create the connection more than once using Qt::UniqueConnection.
Cheers Matthias On 10/2/17 5:30 PM, Tudorache, Marian wrote: > > > > 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
_______________________________________________ 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