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

QML PropertyChanges with Binding changes properties outside Transition

    XMLWordPrintable

Details

    • Linux/X11

    Description

      The problem is that when I assign binding to property inside 'PropertyChanges' and I wanted to make Transition between default and this State - properties of the "target" could be changed 2 times even before Transition was started.

      In following example I wanted to assign binding to _target.opacity property

      states: [
          State {
              name: "shown"
              when: _target.shown
              PropertyChanges { target: _target; numberProperty: 100; opacity: _target.effectiveOpacity; visible: true }
          }
      ]
      

      and I have following Transition:

      Transition {
          to: "shown"
      
          SequentialAnimation {
              ScriptAction {
                  script: console.warn("Transition '' -> 'shown' started");
              }
      
              PropertyAction {
                  target: _target
                  property: "numberProperty"
              }
      
              NumberAnimation {
                  target: _target
                  property: "opacity"
              }                        
      
              ScriptAction {
                  script: console.warn("Transition '' -> 'shown' finished");
              }
          }
      }
      

      After running this application and change _target state to "shown" in the output we will see that property 'numberProperty' was changed 2 times for unknown reason. (Video: property-changes-with-binding.mkv)

      This is the simplest example I could come up with and still reproduce it (on practice I have another binding on 'numberProperty' and extra change of this property outside controllable Transition could produce negative side-effects)

      But when I remove binding from declaration and use simple value - no extra changes occurred and everything works fine as expected

                  states: [
                      State {
                          name: "shown"
                          when: _target.shown
                          PropertyChanges { target: _target; numberProperty: 100; opacity: 1.0; visible: true }
                      }
                  ]
      

      Please find test-project in attachments and video how I've captured this issue.

      P.S. Please correct me with better way to achieve binding assignment as part of PropertyChanges declaration without extra changes of another properties

      Thanks

      Attachments

        1. BallAndGate.zip
          15 kB
        2. MegaBindings.zip
          2 kB
        3. property-changes-with-binding.mkv
          2.47 MB
        4. ugly-gate-jumps.mkv
          955 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tokorpip Tomi Korpipää
            qthorse Denys Shevchenko
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes