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

QML TreeView beginInsertRows broken when expanded

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.10.1
    • Quick: Controls 1
    • None
    • Linux/X11

    Description

      I noticed that incrementally updating the model view for a QML TreeView using beginInsertRows and endInsertRows doesn't work as expected when the rows are expanded.

      My tree looks as follows:

      • root
        • node1
          • subnode1
        • node2
          • subnode2
        • node3

      When I insert a new node between node2 and node3 using beginInsertRows(rootIndex, 2, 2), the new node4 is shown after node3, which is wrong.

      However, when I fold/close the expanded node2 branch and do the same insert, the node4 is correctly inserted between node2 and node3.

      I verified that my model is not the problem, but instead, the QML TreeView seems to behave incorrectly. Emitting layoutChanged() after the insert operation correctly updates the TreeView.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              strahlex Alexander Rössler
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes