QT QStandardItemModel 清除数据方法

QStandardItemModel *model = new QStandardItemModel();
// 假设你已经往 model 中添加了一些数据

model->removeRows(0, model->rowCount()); //保留行标题,清除行数据

model->removeColumns(0, model->columnCount());//清除列数据

model->clear();行列及标题全部清除

 

posted @ 2025-07-04 22:33  txwtech  阅读(53)  评论(0)    收藏  举报