[PyQt] Slot type validation: int/qint64
Florian Bruhin
me at the-compiler.org
Tue Apr 26 19:11:49 BST 2016
Hi!
Thanks to the slot type validation of PyQt 5.6 I discovered a lot of cases
where my decorations where plain wrong...
However in this case I'm unsure what's going on:
Traceback (most recent call last):
File ".../qutebrowser/browser/webpage.py", line 327, in on_unsupported_content
suggested_filename=suggested_filename)
File ".../qutebrowser/browser/downloads.py", line 884, in fetch
download = DownloadItem(reply, self._win_id, self)
File ".../qutebrowser/browser/downloads.py", line 332, in __init__
self.init_reply(reply)
File ".../qutebrowser/browser/downloads.py", line 430, in init_reply
reply.downloadProgress.connect(self.stats.on_download_progress)
TypeError: decorated slot has no signature compatible with downloadProgress(qint64,qint64)
Here is the place where the connection is made:
https://github.com/The-Compiler/qutebrowser/blob/6989d4d2109ee40aad1c2567392dff2a1a324a7e/qutebrowser/browser/downloads.py#L430
self.stats is a DownloadItemStats object:
https://github.com/The-Compiler/qutebrowser/blob/6989d4d2109ee40aad1c2567392dff2a1a324a7e/qutebrowser/browser/downloads.py#L318
And here is the slot, decorated correctly with @pyqtSlot(int, int):
https://github.com/The-Compiler/qutebrowser/blob/6989d4d2109ee40aad1c2567392dff2a1a324a7e/qutebrowser/browser/downloads.py#L234-L235
Using 'qint64', 'qint64' instead works.
I've tried to create a minimal example:
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import pyqtSlot, QUrl
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
@pyqtSlot(int, int)
def slot(num1, num2):
pass
a = QApplication([])
nam = QNetworkAccessManager()
reply = nam.get(QNetworkRequest(QUrl('http://www.riverbankcomputing.com/')))
reply.downloadProgress.connect(slot)
a.exec_()
But that seems to work fine for some reason...
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: Digital signature
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160426/ea5ae5b3/attachment-0001.sig>
More information about the PyQt
mailing list