It is hard for me to understand what you are doing :P QAbstractItemModel::setData() is for setting data to existing index. You set your value to your internal structure "node" so I don't see any reason for model to insert any additional row - so there is no reason to call beginInsertRows() or endInsertRows(), which dont insert any rows - just notify view etc about inserting new rows. And I suggest implementing rows inserting in QAbstractItemModel::insertRow() or QAbstractItemModel::insertRows().
Bookmarks