1

I just constructed a read-write TableModel based on QAbstractTableModel. Works, but the underlying data can change the headers of columns and rows, and I have no idea how to inform the model and views about that (so that views refresh the headers).

If I change the vertical headers (in the data) and then insert a column (through the view->model), the headers are being updated. My I use beginInsertingX in some special way to force the update?

MaciekS
  • 401
  • 8
  • 18

1 Answers1

1

I think you should call beginInserColumns() right before you start editing the model underlying data and endInsertColumns() when you have finished editing.

The model should automatically alert all visible views that they need to repaint data. For radical changes it can be faster if you call beginResetModel() and endResetModel()

Marco
  • 1,952
  • 1
  • 17
  • 23
  • `beginInsertColumns(...)` always forces the view to insert columns. ;-) I thought if I use some special arguments, it could be avoided, but not. -If I use the begin bigger than end, the app crashes. **The only way to change the headers is to use `beginResetModel()` and `endResetModel()`.** – MaciekS May 05 '15 at 08:38