importsys,timefromPyQt5importQtWidgetsfromPyQt5.QtGuiimport*fromPyQt5.QtCoreimport*fromPyQt5.QtWidgetsimport*classEditInList(QListWidget):def__init__(self):super(EditInList,self).__init__()# click to editself.clicked.connect(self.item_clicked)defitem_clicked(self,modelindex:QModelIndex)->None:self.edited_item=self.currentItem()self.closePersistentEditor(self.edited_item)item=self.item(modelindex.row())# time.sleep(0.2)self.edited_item=itemself.openPersistentEditor(item)# time.sleep(0.2)self.editItem(item)defmouseDoubleClickEvent(self,event):# close editforiinrange(self.count()):self.closePersistentEditor(self.item(i))defleaveEvent(self,event):# close editforiinrange(self.count()):self.closePersistentEditor(self.item(i))