treeWidgetItem 编辑,编辑完点击enter后结束
默认的就有这功能
self.treeWidget.itemDoubleClicked.connect(self.treeWidgetOpenEditor) self.treeWidget.itemChanged.connect(self.treeWidgetCloseEditor)
def treeWidgetOpenEditor(self, item, col): if col==0: return self.treeWidget.openPersistentEditor(item,col) self.item = item self.col = col print("treeWidgetOpenEditor") pass def treeWidgetCloseEditor(self): if (self.item != None): self.treeWidget.closePersistentEditor(self.item, self.col) print("treeWidgetCloseEditor")