root
- A <- first RootIndexProxyModel's rootIndex
- C
- D
- empty <- when a new row gets inserted here
- B <- second RootIndexProxyModel's rootIndex
- E
- empty
- empty <- beginInsertRows gets called here
How to reproduce:
Have one source tree model with two sibling subtrees (e.g. above is A subtree with two child rows and B subtree with one child row). One sibling has more rows than the other.
Create two RootIndexProxyModels pointing to the same source model
Set their rootIndexes to siblings in the source model
Insert a new child row to the first sibling which has more rows (A)
Assert gets failed, deubg build crashes.
The problem is that second sibling (B) erroneously calls beginInsertRows passing row more than its rowCount. I modified one test to reproduce the problem (test.patch).
I made a workaround that fixes rows/columns insertion/deletion and it works fine in my project (workaround.patch).
However, this workaround is not complete because I did not fix moving rows/columns and changing layout (I suppose, all signal handlers onXxx should be modified). I did not complete the fix as PR because I don't have full understanding of the code that processes moving rows/columns and changing layout (I haven't had the chance to use this in my project yet).
Suppose we have the following tree model:
How to reproduce:
RootIndexProxyModel
s pointing to the same source modelrootIndex
es to siblings in the source modelThe problem is that second sibling (B) erroneously calls beginInsertRows passing row more than its rowCount. I modified one test to reproduce the problem (test.patch).
I made a workaround that fixes rows/columns insertion/deletion and it works fine in my project (workaround.patch).
However, this workaround is not complete because I did not fix moving rows/columns and changing layout (I suppose, all signal handlers
onXxx
should be modified). I did not complete the fix as PR because I don't have full understanding of the code that processes moving rows/columns and changing layout (I haven't had the chance to use this in my project yet).