How to update a model so it refreshes all its views?
Unsolved
General and Desktop
-
wrote on 5 Aug 2024, 23:42 last edited by
I have a QAbstractTableModel subclass and i want to tell the model that it has been modified so that all its views are refreshed. Currently I have this trick which refreshes but it only refreshes one QTableView:
model->setData(insertIndex, QVariant(-1), Qt::EditRole); ui.tableView->setCurrentIndex(insertIndex);
There must be a more general method at the model level!
-
I have a QAbstractTableModel subclass and i want to tell the model that it has been modified so that all its views are refreshed. Currently I have this trick which refreshes but it only refreshes one QTableView:
model->setData(insertIndex, QVariant(-1), Qt::EditRole); ui.tableView->setCurrentIndex(insertIndex);
There must be a more general method at the model level!
wrote on 6 Aug 2024, 00:22 last edited byYour class implementation of, for example, QAbstractItemModel::setData() should emit the dataChanged() signal. It is all fairly well described in subclassing.
1/2