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

redstone-cold redstone-cold at 163.com
Tue Apr 7 13:25:25 BST 2015


Yes, that's worked, but seems not clean and neat.






在2015年04月07 12时32分, "Alan Ezust"<alan.ezust at gmail.com>写道:


What happens if you change the connection type to Qt.QueuedConnection? Does that help?

I think the direct connection is what is causing the problem.




On Sat, Apr 4, 2015 at 8:24 PM, redstone-cold <redstone-cold at 163.com> wrote:



no matter decorated with @pyqtSlot() or not in PyQt5, this code throw out error 
   Traceback (most recent call last):
     File "test.py", line 39, in on_deleteTasks_triggered
       reply.abort()
   AttributeError: 'QAction' object has no attribute 'abort'
https://bpaste.net/show/73e54a08957d






在2015年04月04 22时14分, "Yuya Nishihara"<yuya at tcha.org>写道:

On Sat, 4 Apr 2015 21:37:41 +0800 (CST), redstone-cold wrote:
> 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.

I see no difference between PyQt4 and PyQt5. Both crashed because self.sender()
is a QAction in on_deleteTasks_triggered(), which is correct.

   Traceback (most recent call last):
     File "test.py", line 39, in on_deleteTasks_triggered
       reply.abort()
   AttributeError: 'QAction' object has no attribute 'abort'

> 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 .

What happens if slotFinished() is decorated as @pyqtSlot() ?

> https://bpaste.net/show/9605c5d7e849








_______________________________________________
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/20150407/47da6a0e/attachment.html>


More information about the PyQt mailing list