-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.15.2
-
None
-
Win10 Python3.8.8 PySide2==5.15.2.1
- Background
- We use PySide2 to develop many kind of tools in one repo.
- We want to track all user behavior by tracking all signals or slots.
- We can get all signals or slots by using app.allWidgets(), and we want to connect these signals to a new function to record to our database.
- Problem
- Core code as below.
app = QApplication(sys.argv + ["--no-sandbox"]) window = MainWindow() window.show() for widget in app.allWidgets(): meta_object = widget.metaObject() for i in range(meta_object.propertyCount()): property = meta_object.property(i) if not property.hasNotifySignal(): continue signal = property.notifySignal() widget.connect(widget, signal, record) # record is our callable function
-
- When we run the codes, it failed and show unsupported signatures as below.
- We have checked the cpp code, it seems QMethMethod.methodSignature() is QByteArray, not bytes.
- So we change the last line code below.
widget.connect(widget, signal.methodSignature().data(), record)
-
- Then new errors with wrong argument as below.
- I have print the type of argument, and it seems match (print results show True True True).
print( isinstance(widget, QObject), isinstance(signal.methodSignature().data(), bytes), isinstance(record, typing.Callable) )
- Other
- Bugs as above, we have attach the code.
- If any other methods can meet the requirements for tracking all signals, you can tell me.