Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Animation on event [solved]
Forum Updated to NodeBB v4.3 + New Features

Animation on event [solved]

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hedge
    wrote on 12 May 2011, 22:15 last edited by
    #1

    I want to fire off a ColorAnimation upon an event (onTextChanged) but couldn't find an example of how to accomplish this.

    Can you hint me into the right direction?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cmer4
      wrote on 13 May 2011, 04:08 last edited by
      #2

      "Here":http://doc.qt.nokia.com/latest/qml-behavior.html

      I think that's what you need, play around with Behavior on text property.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hedge
        wrote on 13 May 2011, 06:35 last edited by
        #3

        This doesn't seem to help me much since I want to change the color-property of a TextEdit once the text-property changes. Behaviours can only be assigned to the same property.

        The following example doesn't work b/c of the on color in ColorAnimation

        @ Behavior on text {
        ColorAnimation on color { from: "yellow"; duration: 1000 }
        }@

        EDIT: With state-changes it works at least once. I want the text turn every time it changes from red to black.
        Changing the state to something else upon completion of the animation (onCompleted) doesn't seem to work at all.

        So what am I supposed to do?

        @ TextEdit {
        id: txtCurrentTrack
        text: "trololol"
        onTextChanged: txtCurrentTrack.state = 'changed'

                        states: [
                            State {
                                name: "changed"
                                PropertyChanges { target: txtCurrentTrack; color: "black" }
                            },
        
                            State {
                                name: "finished"
                                PropertyChanges { target: txtCurrentTrack; color: "grey" }
                            }
                         ]
        
                        transitions: Transition {
                            ColorAnimation {  from: "red"; to: "black"; duration: 1000; onCompleted: txtCurrentTrack.state = "finished"   }
        
                             }
        
                    }@
        
        1 Reply Last reply
        0
        • T Offline
          T Offline
          task_struct
          wrote on 13 May 2011, 13:02 last edited by
          #4

          Hello, try this:

          @TextEdit {
          id: text_edit1
          x: 117
          y: 62
          width: 80
          height: 20
          text: "textEdit"

              onTextChanged: { colAnim.start(); }
          
              PropertyAnimation {
                  id: colAnim
                  target: text_edit1
                  property: "color"
                  from: "red"
                  to: "blue";
                  duration: 1000
                  running: false
              }
          
          }@
          

          "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

          • Linu...
          1 Reply Last reply
          0
          • H Offline
            H Offline
            Hedge
            wrote on 13 May 2011, 17:28 last edited by
            #5

            awesome, it works like a charm.

            1 Reply Last reply
            0

            1/5

            12 May 2011, 22:15

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved