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

Resizing first delegate of BottomToTop ListView moves it outside the visible area

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.11.0
    • None
    • Android, iOS/tvOS/watchOS, macOS

    Description

      More specifically, the unwanted behavior happens when the height of the first delegate is reduced. I have attached a screenshot to better illustrate what's happening - this is after the delegate is resized, and you can see that the delegate is outside the view (because the text is supposed to be centered in the delegate). Also, if I scroll the list, the delegate will be fully visible once more.

      This is the code that I've used to create this minimal reproducible example:

      import QtQuick 2.11
      import QtQuick.Window 2.11
      
      Window {
          visible: true
          width: 640
          height: 480
      
          ListView {
              id: testList
              anchors.fill: parent
              model: 10
              verticalLayoutDirection: ListView.BottomToTop
      
              delegate: Rectangle {
                  id: testDelegate
                  width: parent.width
                  height: 100
                  color: index % 2 === 0 ? "yellow" : "green"
      
                  Text {
                      anchors.centerIn: parent
                      text: index
                  }
                  MouseArea {
                      anchors.fill: parent
                      onClicked: {
                          testDelegate.height -= 20
                      }
                  }
              }
          }
      }
      

      The workaround I've used so far is to avoid using ListView.BottomToTop, and instead applying rotation: 180 to both the list and its delegates.

      If necessary, I can also attach a zip file with the entire project, but it's just a newly-created empty QtQuick Application, with no changes made to it other the main.qml file, which I have shown above.

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            azalisa azalisa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes