2024-06-25 22:45:46 发布
网友
我需要一个QtableView中的值,但是我不知道如何在没有从表中发出信号的情况下执行这个操作。
QtableView
该表从txt文件中获取其值。从表中,我想使用值,但不在表中工作。这张桌子只是个缓冲区。 那么,我如何“获取”表中的所有值,只需按QPushButton,而不需要表本身的任何信号?
QPushButton
QTableView只显示其模型中包含的数据。必须使用此模型才能检索数据。还必须定义要如何存储值。例如:
model = tableView.model() data = [] for row in range(model.rowCount()): data.append([]) for column in range(model.columnCount()): index = model.index(row, column) # We suppose data are strings data[row].append(str(model.data(index).toString()))
QTableView只显示其模型中包含的数据。必须使用此模型才能检索数据。还必须定义要如何存储值。例如:
相关问题 更多 >
编程相关推荐