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

First Item in ListView with sections fails to update layout

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • Some future release
    • 5.1.0
    • None
    • Windows 8 x64/Windows 7 x64, Qt 5.1.0 MinGW OpenGL

      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
          }
      }
      
      

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

              Created:
              Updated:

                There are no open Gerrit changes