[Qgis-developer] PyQt limitations of QGIS sip bindings... is there a workaround?

Luigi Pirelli luipir at gmail.com
Wed Apr 13 04:08:52 PDT 2016


Hi

I've this problem, I want to know the number of listeners connected to a signal.
In c++ this is possibile using QObject.receivers method.

this seems not possibile for c++ binded object to python... or I can't
find how to do.

for example in python console

iface.receivers(SIGNAL("initializationCompleted"))
Traceback (most recent call last):
  File "<input>", line 1, in <module>
RuntimeError: no access to protected functions or signals for objects
not created from Python

and the error comes from:
https://github.com/ifwe/sip/blob/master/siplib/siplib.c#L5717

there is some workaround to this limitation?

the reason of this check is to write tests that can check if a method
register a slot to a specific signal.

Luigi Pirelli

**************************************************************************************************
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS:
https://www.packtpub.com/application-development/mastering-qgis
**************************************************************************************************


More information about the Qgis-developer mailing list