[PyQt] Slot connections fail with newest snapshot

Florian Bruhin me at the-compiler.org
Sun Jul 17 11:09:26 BST 2016


* Phil Thompson <phil at riverbankcomputing.com> [2016-07-16 17:10:55 +0100]:
> On 14 Jul 2016, at 10:32 am, Florian Bruhin <me at the-compiler.org> wrote:
> > 
> > Hi,
> > 
> > I just tried PyQt5_gpl-5.7.dev1607121154 and sip-4.18.1.dev1607032332
> > (with a debug Python build FWIW), and with the attached code I get:
> > 
> >    QObject::connect: Cannot connect QCoreApplication::aboutToQuit() to (null)::lot()
> >    Traceback (most recent call last):
> >      File "foo.py", line 13, in <module>
> >        app.aboutToQuit.connect(obj.slot)
> >    TypeError: connect() failed between aboutToQuit() and lot()
> > 
> > It looks like there's a off-by-one error somewhere, as the method is
> > called "slot", not "lot"?
> > 
> > I noticed it doesn't happen without @pyqtSlot, and it also doesn't
> > happen with a function instead of a method.
> 
> The current behaviour is different, but what are you expecting to
> happen (given your class does not inherit from QObject)?

Oh, @pyqtSlot only works on classes inheriting from QObject? While
that makes some sense, that's news for me!

I think either it should just be ignored (like before?), or show some
useful error message like "pyqtSlot can only be used on classes
inheriting from QObject" or so. I also think this should be pointed
out in the docs for @pyqtSlot - while the examples do inherit from
QObject, it's not explicitly documented anywhere I think.

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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160717/00953542/attachment.sig>


More information about the PyQt mailing list