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

ListView positionViewAtBeginning() does not take topMargin into account

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.6.1
    • None

    Description

      With the code below, the Flickable has `topMargin: 20`. If you run it:

      • The blue background can initially be seen in the 20px margin, as expected
      • Scroll down then click on a list item to invoke `listView.positionViewAtBeginning()`
      • The blue background is not seen as expected, as the list is positioned below the top margin.

      This seems related to QTBUG-87007.

      import QtQuick
      
      Rectangle {
          width: 500
          height: 500
          color: "lightblue"
      
          ListView {
              id: listView
              anchors.fill: parent
              topMargin: 20
              model: 20
      
              delegate: Rectangle {
                  required property int index
                  width: parent.width
                  height: 30
                  border.width: 1
      
                  Text { 
                      anchors.verticalCenter: parent.verticalCenter
                      text: "Item " + index
                  }
      
                  MouseArea {
                      anchors.fill: parent
                      onClicked: listView.positionViewAtBeginning()
                  }
              }
          }
      }
      

      Attachments

        Issue Links

          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
              blammit Bea Lam
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes