PyQt5的TableView使用问题

用setModel方法使用tableView

界面中tableView 新入行后我想赋默认值,但试了很久只找到这个能直接进入编辑状态的方法。

有没有大佬给指点一下

 



row = self.model.rowCount()
self.model.insertRow(row)
index = self.model.index(row, 0)
self.tableView.setCurrentIndex(index)
self.tableView.edit(index)
不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^