[PyQt] QObject::sender() returns the original object that sent the signal
Yuya Nishihara
yuya at tcha.org
Mon Apr 6 16:49:43 BST 2015
On Mon, 6 Apr 2015 16:26:13 +0200, Florian Bruhin wrote:
> I usually use functools.partial[1] to pass the sender to the "real"
> slot explicitely instead of using self.sender(). IMHO, that's cleaner
> and less error-prone.
Dynamic binding is neat, but we have to pay attention to the impedance
mismatch between C++/Qt and Python GC instead, especially if we have several
kinds of long-lived objects.
IIRC, pyqtSlot() and sender() will avoid such headaches. QSignalMapper can also
be used in some cases.
Regards,
More information about the PyQt
mailing list