PropertyActions in SequentialAnimations issue



  • Hello everyone! I'm having an issue using PropertyActions in a SequentialAnimation that I can't quite figure out. I was hoping someone here might have some insight or could tell me what I am doing wrong.

    So I'm setting the "text" property of a Text qml component inside of the animation via a PropertyAction. The value that it is being set to is from a property that is declared above as you can see, and set with a binding where my component is used. When the value is changed, I handle it on the onChanged handler of the property. I see the one debug statement inside of the handler where it is changed, and it is changed to the correct value. I however do not see the debug statement in the textChanged handler of the Text component. This leads me to believe that when I start the animation in the handler, for some reason the PropertyAction doesn't set it to the new value. I was wondering if anyone here could explain why or how I can fix this issue. Thanks ahead of time!

    import QtQuick 2.12
    
    Text
    {
       id: someText
    
       property string animatedText: ""
    
       onAnimatedTextChanged:
       {
          console.log( "text changed: " + animatedText )
    
          if ( someText.text === "" )
             someText.text = animatedText;
          else
             textChangeAnimation.start()
       }
    
       onTextChanged: console.log( text )
    
       SequentialAnimation
       {
          id: textChangeAnimation
    
          NumberAnimation
          {
             target: someText
             property: "opacity"
             from: 1
             to: 0
             duration: 500
          }
    
          PropertyAction
          {
             target: someText
             property: "text"
             value: someText.animatedText
          }
    
          NumberAnimation
          {
             target: someText
             property: "opacity"
             from: 0
             to: 1
             duration: 500
          }
       }
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.