Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.0
-
None
-
Qt 5.6.0 QML Windows 7 mingw
-
b26bfb18616e2a4baf33f9f1a2c147e3f5512de6 (qt/qtquickcontrols/5.14)
Description
TreeView.qml line 49
readonly property var currentIndex: modelAdaptor.mapRowToModelIndex(__currentRow)
In a TreeView, when the selected row was remove in the model, the __currentRow does not changes, but the __currentRowItem change. So the currentIndex need to be updated when the __currentRowItem changes else currentIndex contains a pointer to a deleted entry.
my Patch :
TreeView.qml line 49
readonly property var currentIndex: {__currentRowItem; modelAdaptor.mapRowToModelIndex(__currentRow);}
This path is not the final solution, because when you click on an item of the TreeView currentIndexChanged is emitted two times with the same currentIndex. So if you make something onCurrentIndexChanged, this things is made two times.
May be the good solution is to emit q->currentIndexChanged() in qquickitemview.cpp in updateCurrent(int modelIndex) when currentItem changed even if curentIndex is the same.