QSqlTableModel类继承至QSqlQueryModel类,该类提供了一个可读写单张SQL表的可编辑数据模型,功能:修改,插入,删除,查询,和排序。
关于removeColumns函数的定义如下:
bool QSqlTableModel::removeColumns(int column, int count, const QModelIndex &parent = QModelIndex())
Reimplemented from QAbstractItemModel::removeColumns().
Removes count columns from the parent model, starting at index column.
Returns if the columns were successfully removed; otherwise returns false.
如下例:
model_sqltable->removeColumns(0,3);
意思即为移除从序列0开始的3列,即:0、1、2列共3列。
removeColumn函数
model_sqltable->removeColumn(0); //作用是移除index为0的序列。
注意:
model_sqltable->removeColumn(0);
model_sqltable->removeColumn(1);
model_sqltable->removeColumn(2);
model_sqltable->removeColumns(0,3);