<div dir="ltr">Perhaps adding a @pyqtSlot(QModelIndex,QModelIndex) above the function def will help?<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 5, 2015 at 11:16 AM, Tony Arnold <span dir="ltr"><<a href="mailto:tony.arnold@manchester.ac.uk" target="_blank">tony.arnold@manchester.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have an application with a QTableView and I am trying to connect the<br>
currentRowChanged signal to a slot. When I use the old style, it works,<br>
but the newer style does not.<br>
<br>
Here is the code to connect the signal using the old style:<br>
<br>
self.connect(self.competitionView.selectionModel(),<br>
SIGNAL("currentRowChanged(QModelIndex,QModelIndex)"),<br>
self.competitionChanged)<br>
<br>
and the slot is defined as:<br>
<br>
def competitionChanged(self, index):<br>
<br>
This works fine.<br>
<br>
But if I connect the signal with the preferred new style so:<br>
<br>
self.competitionView.selectionModel().currentRowChanged.connect(self.competitionChanged)<br>
<br>
Then an exception gets raised when the slot gets called. I get the<br>
following error:<br>
<br>
The debugged program raised the exception unhandled TypeError<br>
"competitionChanged() missing 1 required positional argument: 'index'"<br>
<br>
I am using PyQt4 and python 3.4 with Qt 4.8.6<br>
<br>
Any suggestions where I might be going wrong?<br>
<br>
Regards,<br>
Tony.<br>
<span class="HOEnZb"><font color="#888888">--<br>
Tony Arnold, IT Security Analyst, University of Manchester.<br>
T: <a href="tel:%2B44%20%280%29%20161%20275%206093" value="+441612756093">+44 (0) 161 275 6093</a>, F: <a href="tel:%2B44%20%280%29%20705%20344%203082" value="+447053443082">+44 (0) 705 344 3082</a>,<br>
M: <a href="tel:%2B44%20%280%29%20773%20330%200039" value="+447733300039">+44 (0) 773 330 0039</a>, E: <a href="mailto:tony.arnold@manchester.ac.uk">tony.arnold@manchester.ac.uk</a><br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></font></span></blockquote></div><br></div>