要清空QTableView的缓存,可以使用以下代码:

model = tableView.model()
model.clear()

这将清空表格中的所有数据。如果您只想清空特定的缓存,可以使用以下代码:

model = tableView.model()
model.removeRows(0, model.rowCount())

这将从表格的第一行开始删除所有行。


原文地址: http://www.cveoy.top/t/topic/iRRQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录