I have my own QAbstractTableModel subclass. When new data is inserted in it - I issue beginInsertRows/endInsertRows and then dataChanged with correct indexes. rowCount seems to be changed OK as I see scroller appear and grow, but .... columnCount is not.
The sequence is this:
1) I populate the model BEFORE inserting it into tableview. This way view catches proper amount of columns.
2) I insert the model into the view first, then populate it with data. In this case, even after dataChanged is issued the view will not show anything because it seems like it still thinks that there are no columns. (coulmnCount() returns proper amount - I checked, a few times)
From what I've read in Qt docs it does not look like I need to manually call beginInsertColumns for most models... why then the view fails to pick column count when model receives data?
P.S.In the second case calling after populating the model:
view->setModel(0);
view->setModel(model);
sets the column count to proper value but this is ugly...
UPD: I've found that emitting
emit headerDataChanged(Qt::Horizontal, 0 , columnCount());
does fix the column problem, but docs say that I should not........ :)