Update non-editable QTableView with QAbstractTableModel
-
How to update QTableView when my model changes? My QTableView is non editable, so afaik i dont have/want to reimplement setData(...).
How do i update it, after my internal data changes?class myTableModel : public QAbstractTableModel { ... void SetMyData(MyDataType* myData) { m_myData = myData; emit QAbstractItemModel::dataChanged(index(0, 0), index(myData->rows(),myData->Cols())); } ... }
Doesn't work, neither tableView->update() does.
thanks for help
-
Hi,
Since you are replacing your underlying data, I'd rather go with modelReset
-
problem is that index(myData->rows(),myData->Cols())
is not a valid indexit should be
index(myData->rows()-1,myData->Cols()-1)
if functions are named correctly