I have a table in pyqt5 and when I modify a cell I call a method(changeIcon), inside this method I use an if statement to check which column has been changed and based on the column I change some items, everytime I modify the column 3 and 4 it returns me this error:
Traceback (most recent call last):
File "c:\FOLDER\App.py", line 291, in Change_method
RecursionError
This is the code :
def tabledata(self)
.....
self.tabella_registrazioni.itemChanged.connect(self.changeIcon)
.....
def changeIcon(self, item):
row = item.row()
col = item.column()
custcode = self.tabella_registrazioni.item(row, 3).text()
custname = self.tabella_registrazioni.item(row, 4).text()
if col == 3 :
if not custcode.isspace() and custcode != " " and custcode != "":
cname = d.execute("SELECT 1 FROM CODES WHERE ANCODICE = ?", (custcode)).fetchone()[0]
if cname != None:
self.tabella_registrazioni.setItem(row, 4, QtWidgets.QTableWidgetItem(str(cname)))
if col == 4 :
if not custname.isspace() and custname != " " and custname != "":
ccode = d.execute("SELECT 2 FROM CODES WHERE ANDESCRI = ?", (custname)).fetchone()[0]
if ccode != None:
self.tabella_registrazioni.setItem(row, 3, QtWidgets.QTableWidgetItem(str(ccode)))
Change_method?