Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.7.0
-
None
Description
There are 2 bugs in the adaptor model used for the QML TreeView control that cause issues when moving items from one index to another.
1) Any movement of an item that results in the item being displayed on the same row in the TreeView control causes the adaptor model's paired calls to beginMoveRows/endMoveRows to fail in QQuickTreeModelAdaptor1::modelRowsAboutToBeMoved. The adaptor should be checking the return value of beginMoveRows, and if it returns false then it should not call endMoveRows. Better yet, it should check if the row is being moved to the same row and skip the calls to beginMoveRows and endMoveRows.
2) Any movement of an item that results in the item being the first child added to a parent item causes a row number of negative 1 to be passed to the model's index function when determining the destination index in QQuickTreeModelAdaptor1::modelRowsAboutToBeMoved. If the destinationRow is zero and the rowCount of the destinationParent index is zero then the destinationParent index should be passed to the itemIndex function instead of the index returned from m_model->index(-1, 0, destinationParent).
I also request that the mapRowToModelIndex, isExpanded, and rowCount functions on the adaptor model be exposed to the TreeView directly so calls through the "private" __model member can be avoided.
You may also want to take a look at the styleData object used in the TreeView's itemDelegate member. I have found that the styleData.index member is not correct after items have been moved, which is why I have been forced to use the "private" __model member to obtain the correct index for a given row number.
Attachments
Issue Links
- is required for
-
QTBUG-56490 Rearchitect the TreeView from Controls 1 and move to Controls 2
- Closed