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

First Item in ListView with sections fails to update layout

    XMLWordPrintable

Details

    Description

      I try to resize Items in a ListView according to my window size. That works, but the first item of a ListView with sections gets a wrong position. Try this and then resize the Window/Rectangle while it is running. This DOES work, when the size is changed before the model of the ListView is filled. This does not work, if the size is changed while everything is loaded and displayed.

      import QtQuick 2.0
      
      Rectangle {
          id: mainWindow
          width: 800
          height: 600
      
          ListModel {
              id: lm
              ListElement {
                  category: "Human Players"
                  name: "Player 1"
              }
              ListElement {
                  category: "Human Players"
                  name: "Player 2"
              }
              ListElement {
                  category: "AI Players"
                  name: "AI 1"
              }
              ListElement {
                  category: "AI Players"
                  name: "AI 2"
              }
          }
      
          ListView {
              model: lm
              delegate: Text {
                  text: name
                  font.pixelSize: 20 * (mainWindow.height / 600)
              }
              section.property: "category"
              section.delegate: Text {
                  text: section
                  font.pixelSize: 40 * (mainWindow.height / 600)
              }
              anchors.fill: parent
          }
      }
      
      

      Attachments

        1. afterresize1.png
          afterresize1.png
          28 kB
        2. afterresize2.png
          afterresize2.png
          8 kB
        3. beforeresize.png
          beforeresize.png
          14 kB
        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
            yoktobit Martin Windolph
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes