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

Qt 5.2 regression — QML property not updated properly

    XMLWordPrintable

Details

    Description

      In the recent snapshots a new regression appeared. I haven't checked exactly when, however the build I did on Nov 08 seems to be OK, while the recent snapshots fail.

      Please consider the following QML code:

      import QtQuick 2.0
      
      
      Rectangle {
          id: topRect
      
          width: 100
          height: 100
          color: "lightgrey"
      
      
          onCalcHeightChanged: {
              console.debug(">> [topRect] topRect.calcHeight: ", topRect.calcHeight)
              console.debug("[topRect] topRect.height", topRect.height)
              console.debug("[topRect] layoutRow.height: ", layoutRow.height)
          }
      
      
          //If I assign "100 - layoutRow.height" it works
          //If it is "height - layoutRow.height" it does not work
          property real calcHeight: height - layoutRow.height
      
          Row {
              id: layoutRow
      
              onHeightChanged: {
                  console.debug(">> [layoutRow] topRect.calcHeight: ", topRect.calcHeight)
                  console.debug("[layoutRow] topRect.height", topRect.height)
                  console.debug("[layoutRow] layoutRow.height: ", layoutRow.height)
              }
      
              Rectangle {
                  id: innerRect
                  width: 100
                  height: 20
                  color: "purple"
              }
          }
      }
      

      The property calcHeight (bound to "height - layoutRow.height") is not updated when layoutRow.height changes.

      The output I receive with Nov 25 snapshot is:

      >> [topRect] topRect.calcHeight:  100
      [topRect] topRect.height 100
      [topRect] layoutRow.height:  0
      >> [layoutRow] topRect.calcHeight:  100
      [layoutRow] topRect.height 100
      [layoutRow] layoutRow.height:  20
      

      while the older builds (eg. Qt 5.1) produce, as should be expected, as follows:

      >> [topRect] topRect.calcHeight:  100
      [topRect] topRect.height 100
      [topRect] layoutRow.height:  0
      >> [layoutRow] topRect.calcHeight:  100
      [layoutRow] topRect.height 100
      [layoutRow] layoutRow.height:  20
      >> [topRect] topRect.calcHeight:  80
      [topRect] topRect.height 100
      [topRect] layoutRow.height:  20
      

      Attachments

        1. childrenRectTest.qml
          0.9 kB
        2. main.cpp
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shausman Simon Hausmann
            mwu Michał Urbańczyk
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes