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

ScrollView contentWidth/Height no longer updates when content width/height changes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 5.12.3
    • 5.12.1
    • Quick: Controls 2
    • None

    Description

      The example works in Qt 5.12.0 and does not in 5.12.1.

      Expected:

      1. Open example and click button to add rectangles to the repeater within the ScrollView.
      2. The 'contentWidth' value (displayed on the button) should update, and once the rectangles reach the edge of the ScrollView, it should come scrollable.

      Actual:

      1. Open example and click button to add rectangles to the repeater within the ScrollView.
      2. The 'contentWidth' value (displayed on the button) does not update, and once the rectangles reach the edge of the ScrollView, the ScrollView remains unscrollable.

      This means that a ScrollView can no longer dynamically update its scrollability when the content within it changes. 

      Example for contentWidth:

      import QtQuick 2.9
      import QtQuick.Controls 2.2
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Scroll")
      
          Button {
              anchors.top: parent.top
              id: button
              text: "Click this to add boxes. (contentWidth = " + scrollView.contentWidth + ")"
              onClicked: repeater.model += 1
          }
      
          ScrollView {
              id: scrollView
              anchors.top: button.bottom
              anchors.left: parent.left
              anchors.right: parent.right
              anchors.bottom: parent.right
      
              Row {
                  spacing: 2
                  Repeater {
                      id: repeater
                      model: 5
                      delegate: Rectangle {
                          height: 50
                          width: 50
                          color: "red"
                      }
                  }
              }
          }
      }
      
      

       

      Example for contentHeight:

      import QtQuick 2.9
      import QtQuick.Controls 2.2
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Scroll")
      
          Button {
              anchors.top: parent.top
              id: button
              text: "Click this to add boxes. (contentHeight = " + scrollView.contentHeight + ")"
              onClicked: repeater.model += 1
          }
      
          ScrollView {
              id: scrollView
              anchors.top: button.bottom
              anchors.left: parent.left
              anchors.right: parent.right
              anchors.bottom: parent.right
      
              Column {
                  spacing: 2
                  Repeater {
                      id: repeater
                      model: 5
                      delegate: Rectangle {
                          height: 50
                          width: 50
                          color: "red"
                      }
                  }
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              richard Richard Moe Gustavsen
              danielserato Daniel McBride
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes