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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.14.2
    • Fix Version/s: None
    • Labels:
      None

      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 Harald Hvaal.

       

       

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-86695
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              fabiankosmale Fabian Kosmale
              Reporter:
              andrhans Andreas Aardal Hanssen
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There is 1 open Gerrit change