PDA

View Full Version : Need an explanation about begininsertrows.endinsertrows.



tonnot
14th April 2011, 10:05
I dont understand this process.
I see how the tablemodel::data reimplemented is asking me data for a row, col. I return data from my own data-sytem (for example a map).
Ok, if I insert rows or cols, begininsert-endinsert does nothig with my map , isn't it ?
So, what is the mission of this ?
Imagine I have 1,2,3,4,5 rows. I insert a new row at position3, so I have
1,2,new,3,4,5.
Now, tablemodel::data are going to ask me data for 1,2,3,4,5,6. So I dont understand the mission of begininsert-endinsert. Besides, the rowcount are also reimplemented.
Begin-end is not neccesary if I have my own data system?
Any help ? Thanks

wysota
14th April 2011, 10:08
Ok, if I insert rows or cols, begininsert-endinsert does nothig with my map , isn't it ?
So, what is the mission of this ?
It informs the views what parts of model have been inserted or removed and it updates the list of persistent indexes.


Begin-end is not neccesary if I have my own data system?
It's necessary.

tonnot
14th April 2011, 11:56
Thank WY.
Can explain more in detail the mission of 'the list of persistent indexes.' ?
What information are they store ?
Thanks

wysota
14th April 2011, 15:13
See QPersistentModelIndex.