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

redstone-cold redstone-cold at 163.com
Sat Apr 4 14:37:41 BST 2015


The PyQt4 version of the same code , self.sender() returns a QNetworkReply,the direct object that sent the signal,while in PyQt5,it  returns the original object that sent the signal.


here, on_deleteTasks_triggered() call reply.abort(), thus emitted finished signal of reply,
then slotFinished() was invoked, so I think the original object that sent the signal was QAction, the direct one should be QNetworkReply,QObject::sender() should return the DIRECT object that sent the signal in this case or else cause so many problems .








在2015年04月04 19时27分, "Florian Bruhin"<me at the-compiler.org>写道:

* redstone-cold <redstone-cold at 163.com> [2015-04-04 19:08:05 +0800]:
> I saw some fix on QObject::sender() showed in the change log, but as I tested, the bug has not been fixed yet .
>
>
> tested code here
>
> https://bpaste.net/show/9605c5d7e849
> when self.deleteTasks triggered, self.sender() should return QNetworkReply rather than QAction
>
>
> if the url doesn't work there, please use another URL without redirection and also  direct to some large file.

I don't understand - how would the self.deleteTasks QAction possibly
know anything about the QNetworkReply? It's an object ompletely
independent from the reply. And deleteTasks.triggered gets sent by the
QAction, so why would self.sender() suddenly be a QNetworkReply?

Florian

--
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
  GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
        I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150404/cfac505a/attachment.html>


More information about the PyQt mailing list