The function myTableView->model()
returns a QAbstractItemModel
which does not contain the clear()
method. You should call clear method of your model. If you have a model like:
QStandardItemModel * model= new QStandardItemModel( 2, 4 );
Calling clear should delete all data from the model erasing the view as a consequence as it is provided to show data in the associated model:
model->clear();