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

RowLayout lays out dynamically created items in the wrong order

    XMLWordPrintable

Details

    • 42c04ed29c36eec70cdce58e5c2d19faec62d039

    Description

      If a Repeater is in a RowLayout with other items, and the Repeater's model changes, creating a new repeated Item, then the Item appears as the last thing in the RowLayout, not in the correct order as specified by the Repeater.

      If you run this code, for example, the 6th created red Rectangle appears in the right of the window, after the spacer Item. It should appear left of it.

      import QtQuick 2.3
      import QtQuick.Layouts 1.1
      
      Rectangle {
        color: "black"
        width: 500
      
          RowLayout {
              anchors.fill: parent
              spacing: 10
              Repeater {
                  id: repeater
                  model: 5
      
                  Rectangle {
                      color: "red"
                      width: 20
                      height: 20
                  }
              }
      
              Item {
                  Layout.fillWidth: true
              }
          }
      
          Timer {
              running: true
              interval: 3000
              repeat: false
      
              onTriggered: {
                  repeater.model = 6;
              }
          }
      }
      

      Attachments

        Activity

          People

            smd Jan Arve
            sixohsix Mike Verdone
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: