Re: Problem with signal and slot arguments
Florian Bruhin <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
Hey Sietse, On Tue, Oct 29, 2019 at 11:08:29AM +0100, [email protected] wrote: > [...] > > @pyqtSlot() > def addDevice(self, info): > if info.coreConfigurations() & QtBt.QBluetoothDeviceInfo.LowEnergyCoreConfiguration: > self.setUpdate(f'Last device added: {info.name}') > > Running this gets me the following error: > > TypeError: addDevice() missing 1 required positional argument: 'info' > > With ipython3 this seems to be a warning, with python3 the progam aborts immediately. > > It seems that the slot is being called without the info argument, but signal > QBluetoothDeviceDiscoveryAgent().deviceDiscovered > does have the argument. > > What am I doing wrong here? The @pyqtSlot decorator takes the types of the slot arguments, so your @pyqtSlot() decorator means "this is a slot without any arguments". You probably want @pyqtSlot(QBluetoothDeviceInfo) instead. Florian -- https://www.qutebrowser.org | [email protected] (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/ _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE4E5WAAJAG47w528KkW6wyP1VoHIFAl24EcQACgkQkW6wyP1V oHK8Jw//Yvni2nSiQZ3mA0Chg4tvwcKJJz/li/0lbY0K6z/08xAxnJsLTAWREzbB r5+CXQP7IgQjZyymITg5Paga8x7tW/IUEUEL3auTWEUp1oPgl2Y+A/YDqgzq6Kow Ws9FRlNYL9axM90cWsfBN5mXWwkAQcTnLJJvyTXSkNNNHNx15T7gvVU+MR/e0+Zv eBnbClpXd8gZ6IXFUh50e1/qiatpTQYoUbmNpC+f7qHOdG2/WsXj4RD2lZQaYJmr DXtwycwNhXJCZtM4BcucJ6eHMzpS0AW1E+J0Qej8oZ9KF1Y9D9RYqn3LVE1Bh91w NhukYN1cy5zNU/t9qcRfttHHwFm2p4ev0fr8/ywnVGbe6VWTciuJ3P+LlmuLMHxY Hpmm5hdDVeo+pfObDUGnhWmfVSoVa2mn7d7GcZtnyrYx91yqUuS29L6TPE6h8N4o IqUYNaMQUtFQQaddHqEJ0bKuRCbJvmtaRjkF8WXCLCOu/WzZjY9uqVm5j0H+Qvc5 bClCKpjHLQZ814/RdmIHdwsTwvbCHe7VlD0Wl6HP7YD93imT8GoCQo8LKLWmiN5A fXgaLx0gUTNZe/UJghV2H8rMGmrNIysvJNMdEa/0DoTGrlWLlVBsjl/M1/781V2l X8pk9pgwi0GiKWNnZiWQfex2Quq7PjmkmteoGtYqUdPX/t9650o= =0I7l -----END PGP SIGNATURE-----