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

Binding with Listview height are not correctly calculated

    XMLWordPrintable

Details

    Description

      When some property, say x, has a binding with Listview's height and ListView height has binding with its parent height, x is not calculated as expected.
      Please refer to the attached sample, you can see that delegateHeight has a binding with ListViews's height and is then used to calculate preferredHighlightBegin/End. But due to wrong calculations, some other index(other than currentIndex) is highlighted.

       ListView {
              id: listview
              //It works with those 2 lines instead of anchors.fill: parent
              //        width: 640
              //        height: 351
              anchors.fill: parent
              property real heightRatio: 0.20
              property int delegateHeight: heightRatio * height
      ....
              preferredHighlightBegin: (height-delegateHeight)/2
              preferredHighlightEnd: (height+delegateHeight)/2
               // It works if delegateHeight is not used
              //preferredHighlightBegin: (height-(height*heightRatio))/2
              //preferredHighlightEnd: (height+(height*heightRatio))/2
      ..
      }
      

      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
              shmittal Shveta Mittal
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes