I'm working with Python 3.3 PyQt5. I have an QListView widget which is contains some items. I want to retrieve item when user double-click to item and edit it so I can save its new value to a database. But I can't find any SIGNAL like edit finished or something useful.
class MainWin(QtWidgets.QMainWindow):
itemName = ""
def __init__(self, inheritance=None):
super(MainWin, self).__init__()
self.ui=uic.loadUi("MainWin.ui", self)
self.wordList = FileProc.WordStorage().readWordFile()
self.showListView()
self.itemName = ""
def showListView(self, file = 'wordlist.db'):
MainWin.wordList = FileProc.WordStorage().readWordFile(file)
model = QtGui.QStandardItemModel(self.listView)
for row in MainWin.wordList:
item = QtGui.QStandardItem(row)
model.appendRow(item)
self.listView.setModel(model)
def editWord(self):
itemIndex = self.listView.selectedIndexes()
MainWin.itemName = itemIndex[0].data()
I displayed list within this way. I want to retrieve edited word with editWord() method. How can I execute editWord() after item in the listView changed?