Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
4.8.2
-
windows 7
Description
Let us assume a sourceModel as shown below:
=====Column1==||===Column2=||===Column3
A COL2 COL3
---X COL2 COL3
---Y COL2 COL3
---Z COL2 COL3
B COL2 COL3
---X COL2 COL3
---Y
---Z
C
---X
---Y
---Z
etc... --denotes a child. so X happens to be the child of A. Each of X, Y and Z are different. It is just that their display role has same value.
Suppose, you show this sourceModel in a QTreeView srcTreeView.
Now, you want a QSortFilterProxyModel so that if you click on a item on srcTreeView, it shows all it's children which don't have the name Y. and only column1 and column3
so if A,B OR C is clicked, it QSFPM attached view has to show as:
==COLUMN1==||COLUMN2
X COL3
Z COL3
filteracceptrows() and filteracceptcolumn() is written accordingly. Now the view attached to QSFPM is showing x and z of A if A is clicked on srcTreeView(assuming selectionChanged properly overridden which intimates QSFPM of selectionChanged so that it can QSFPM view can setRootIndex).
As we click on srcTreeView items, rows are being added and removed from QSFPM as reported by qmodeltest. Suppose we select item Y in srcTreeView, then select A.
Now if item Y under A is removed in sourcemodel in a function with calls beginremoverows() and endremoverows(), it will lead to crash, with following Q_ASSERT message:
ASSERT: “cm” in file itemviews/qsortfilterproxymodel.cpp line 935.
This happens, because item Y which has been removed is being searched in QSFPM internal mappings, and not being found.