I implement my model based on QAbstractItemModel, and I use it with QTreeView to display hierarchical data. Data is stored in a sqlite table.
My question is how should I call beginInsertRows when adding subnodes. Suppose I have a parent node, it contains 10 subnode. And I want to add a new subnode (at the end).
I do it like this:
beginInsertRows(parentIndex, currentNodesCount, currentNodesCount);
currentNodesCount contains a value of 10, which is the number of rows in this tray. The new node will be placed at 11th position (10th count from 0).
Is this logic correct?
Thanks for the help.
I am also interested in using beginRemoveRows.
Is it correct:
beginRemoveRows(parentIndex, currentRow, currentRow); // delete record endRemoveRows();
currentRow contains a position in the list of remote node counts from 0.
user666491
source share