<div dir="ltr"><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno sab 4 mar 2023 alle ore 17:59 Björn Künsting <<a href="mailto:bjoern@corecode-dev.com">bjoern@corecode-dev.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I am using PyQt6 on Linux and get the following error when decorating a<br>
function to receive QAbstractItemModel.dataChanged signals. <br>
<br>
TypeError: decorated slot has no signature compatible with<br>
dataChanged(QModelIndex,QModelIndex,QList<int>)<br>
<br>
The decorated function (inside a class):<br>
<br>
@pyqtSlot("QModelIndex", "QModelIndex", "QList<int>")<br>
def on_changed(self, tl: QModelIndex, br: QModelIndex, roles:<br>
List[int])<br>
<br>
<br>
On Windows, the same code runs flawlessly.<br></blockquote><div><br></div><div>It might be a bug (it seems strange that it affects Linux only, though), are you sure you're using the same versions?</div><div><br></div><div>That said, remember that:</div><div><br></div>- the types of slot/signal/property decorators can also be used without the string notation, if the type is available;<br>- slots may have *less* positional arguments than the signals they are connected to, so, unless you specifically need the "roles" argument, you can completely remove it from the slot:<br><br><span style="font-family:monospace">@pyqtSlot(QModelIndex, QModelIndex)</span><br><br>- slot decorators are not mandatory, and are usually required only for very specific cases;<div> </div></div></div><div><br></div><div>Il giorno lun 6 mar 2023 alle ore 15:25 Tony Arnold <<a href="mailto:a.c.arnold@gmail.com">a.c.arnold@gmail.com</a>> ha scritto:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="text-align:left;direction:ltr" bgcolor="#ffffff"><div></div><div>Shouldn't the type-hint the roles parameter be QList[int]? You have just List[int].</div></div></blockquote><div><br></div><div>The type hints should be irrelevant for the slot definition, and, besides, QList does not exist in Python/PyQt.</div><div><br></div><div>Maurizio<br></div><div></div></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div></div>