This probably sounds like a simpleton question but...

Every example I have seen, including the abstractitemmodel which is included with QtCreator does the following:

beginInsertRows(QModelIndex(), rowCount(), rowCount());

On a very first call I guess a QModelIndex does have to be created, however, the example repeatedly calls this method:

model.addAnimal(Animal("Wolf", "Medium"));
model.addAnimal(Animal("Polar bear", "Large"));
model.addAnimal(Animal("Quoll", "Small"));


I'm asking because, while it "seems" to work, it 'duth maketh no senseth'. Why? Because, it would seem to me, one should be using the same index between the view and the model.

I'm asking because I'm currently writing an application which "periscopes" over a large database showing only a few rows at a time in the view. I am adding and deleting rows in my model all of the time. It would seem creating a new QModelIndex() each time I insert/remove rows should send things into a stack dump situation at some point.

Are all of these examples just really bad or am I missing something in the documentation?

Thanks,