[PyQt] 回复: QObject::​sender() returns the original object that sent the signal

iMath 2281570025 at qq.com
Sat Feb 14 11:45:40 GMT 2015


tested again with PyQt5.4 on Win7


if decorate the slot with pyqtSlot(),sender() returns the direct object that sent the signal,


if not , returns the original object that sent the signal.‍





------------------ 原始邮件 ------------------
发件人: "phil";<phil at riverbankcomputing.com>;
发送时间: 2015年2月13日(星期五) 晚上9:54
收件人: "pyqt"<pyqt at riverbankcomputing.com>; 

主题: Re: [PyQt]QObject::​sender() returns the original object that sent the signal



On 11/02/2015 3:15 am, iMath wrote:
> In PyQt4,QObject::​sender() returns the direct object that sent the
> signal,while in PyQt5,it  returns the original object that sent the
> signal.
> 
> 
> QObject::​sender() should return the DIRECT object that sent the
> signal or cause so many problems .‍

According to my tests PyQt4 and PyQt5 behave the same. sender() behaves 
differently if you decorate the slot with pyqtSlot(). I haven't quite 
worked out why that is the case.

Phil
_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150214/a789a447/attachment-0001.html>


More information about the PyQt mailing list