核心代码:
def add_camera(self):
'''
添加摄像头
:return: None
'''
num = self.tableWidget.rowCount()
self.tableWidget.setRowCount(num+1)
def remove_camera(self):
'''
删除摄像头
:return:
'''
index = self.tableWidget.selectedRanges() # 1
index = index[0].bottomRow()
self.tableWidget.removeRow(index)
- 是为了获取到光标选中的行索引