Details
Description
`QObject.sender()` returns None when called within a slot which was inherited from a superclass.
In this example the second output line should be an instance of `_main_.B`:
from PySide6 import QtCore class A(QtCore.QObject): @QtCore.Signal def mySignal(self): ... def __init__(self) -> None: super().__init__() self.mySignal.connect(self.mySlot) @QtCore.Slot() def mySlot(self): print(self.sender()) class B(A): ... if __name__ == "__main__": a = A() b = B() a.mySignal.emit() b.mySignal.emit()
Output:
<__main__.A(0x18498f7dd20) at 0x0000018499327380> None
Attachments
Issue Links
- duplicates
-
PYSIDE-1295 Sender from signal with private callback is None
- Closed