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

Qt 5.8 does not re-evaluate bindings in cases that Qt 5.6 did

    XMLWordPrintable

Details

    Description

      Here is a distilled testcase. With Qt 5.6 "Hello" is changed to "Goodbye" after two seconds, because someProp changes value.

      With Qt 5.8, the change does not occur. Presumably, because the use of the property is inside an if() which is initially false, the QML engine does not track the property for changes.

      import QtQuick 2.3
      
      Item {
          id: root
      
          width: 500
          height: 500
      
          property string someProp
      
          property var someObject: {return {
              cond: false
          }}
      
          function refreshText() {
              if (someObject.cond) {
                  return someProp
              }
              return "Hello"
          }
      
          Text {
              width: 100
              height: 100
              x: 100
              y: 100
              text: refreshText()
          }
      
          Timer {
              running: true
              interval: 1000
              onTriggered: {
                  console.log("Change condition")
                  someObject.cond = true;
              }
          }
      
          Timer {
              running: true
              interval: 2000
              onTriggered: {
                  console.log("Change string")
                  someProp = "Goodbye"
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              shausman Simon Hausmann
              ske Steve
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes