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

Flickable::maxYExtent reports wrong value when contentHeight < height

    XMLWordPrintable

Details

    • I6416d0e23c3ef898887a7b3e3fcdc1dc12853548

    Description

      This impacts the flick dynamics as well as the value of visibleArea.heightRatio (which becomes outside the 0-1 range promised in the documentation).

      The following example illustrates the issue by comparison with ListView. In this example the ListView flick dynamics and scrollbar are correct, while the Flickable's are not.

      import QtQuick 2.0
      
      Item {
          width: 800; height: 600
      
          Rectangle {
              anchors.bottom: parent.bottom
              width: parent.width
              height: 200
              color: "blue"
          }
      
          Row {
      
              ListView {
                  id: listView
                  width: 400; height: 400
                  model: 1
      
                  delegate: Rectangle {
                      width: 400
                      height: 200
                      color: "green"
      
                      Text {
                          anchors.centerIn: parent
                          color: "white"
                          text: "ListView"
                      }
                  }
      
                  children: [
                      Rectangle {
                          anchors.right: parent.right
                          y: listView.visibleArea.yPosition * listView.height
                          width: 10
                          height: listView.visibleArea.heightRatio * listView.height
                          color: "black"
                      }
                  ]
              }
      
              Flickable {
                  id: flickable
                  width: 400; height: 400
                  contentHeight: 200
                  contentWidth: 400
      
                  Rectangle {
                      width: 400
                      height: 200
                      color: "red"
      
                      Text {
                          anchors.centerIn: parent
                          color: "white"
                          text: "Flickable"
                      }
                  }
      
                  children: [
                      Rectangle {
                          anchors.right: parent.right
                          y: flickable.visibleArea.yPosition * flickable.height
                          width: 10
                          height: flickable.visibleArea.heightRatio * flickable.height
                          color: "black"
                      }
                  ]
              }
          }
      }
      

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            mbrasser Michael Brasser
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes