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

QML TreeView beginInsertRows broken when expanded

XMLWordPrintable

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

      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.

        1. image-2018-09-04-13-26-35-699.png
          30 kB
          Alexander Rössler
        2. image-2018-09-04-13-27-41-839.png
          31 kB
          Alexander Rössler
        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
            strahlex Alexander Rössler
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes