Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-55947

Issues when moving items in QML TreeView control



    • Type: Bug
    • Status: Reported
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: 5.7.0
    • Fix Version/s: None
    • Component/s: Quick: Controls 1
    • Labels:


      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.


          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.



              qt.team.quick.subscriptions Qt Quick and Widgets Team
              andy.fillebrown.asi Andy Fillebrown
              3 Vote for this issue
              5 Start watching this issue



                  Gerrit Reviews

                  There are no open Gerrit changes