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

[REG: 5.12 -> 5.14] Broken State::when behavior after suspicious change

    XMLWordPrintable

Details

    • a8c729d839 (qt/qtdeclarative/dev) cb4594718a (qt/qtdeclarative/6.3) cb4594718a (qt/tqtc-qtdeclarative/6.3) a8c729d839 (qt/tqtc-qtdeclarative/dev) c2b6f09d28 (qt/qtdeclarative/6.2) c2b6f09d28 (qt/tqtc-qtdeclarative/6.2) c2b6f09d28 (qt/qtdeclarative/6.2.4)

    Description

      The following example shows a state group with two defined states, with one when-binding each. It seems well-defined and behaves correctly in Qt 5.12.6, but not in Qt 5.14.2. The issue is that the state string visits the empty string "" in a transition between two well defined states.

      Notice how root.number is 2, and is set to 1 with a timer. The state group defines states for when number is 1 and 2.

       

      import QtQuick 2.11
      
      Item {
          id: root
          property int number: 2
          Timer {
              interval: 500
              running: true
              repeat: false
              onTriggered: {
                  root.number = 1
              }
          }
          Item {
              id: item
              onStateChanged: console.log("state changed to", state);
              states: [
                  State {
                      name: "n1"
                      when: root.number === 1
                  },
                  State {
                      name: "n2"
                      when: root.number === 2
                  }
              ]
          }
      }
      
      # With Qt 5.12.6:
      qml: state changed to n2
      qml: state changed to n1

       

      # With Qt 5.14.2:
      qml: state changed to n2
      qml: state changed to  
      qml: state changed to n1

      Notice the empty state "". This state change naturally breaks transition animations.

      We find this commit suspicious but cannot see what the possible fix is:

       

      commit 64c1fbe96c68b1286a70242ff4922be140128cb2 
      Author: Fabian Kosmale <fabian.kosmale@qt.io> 
      Date:   Tue Jul 2 13:23:09 2019 +0200 
       
          use boolean for when property

      Headsup hhvaal.

       

       

      Attachments

        Issue Links

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

          Activity

            People

              fabiankosmale Fabian Kosmale
              andrhans Andreas Aardal Hanssen
              Votes:
              8 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes