每当删除一行后,垂直表头的行号并没有重新排序,需要手动来设置 for r in range(self.rowCount()): self.verticalHeaderItem(r).setText(str(r+1))