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. Transition onRunningChanged only call new.state for specific State name [solved]

Transition onRunningChanged only call new.state for specific State name [solved]

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.8k 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.
  • D Offline
    D Offline
    dstudentx
    wrote on last edited by
    #1

    I'm using the code below for an animation of a specific mousearea. When the mousearea is clicked the animated is fired and when completed the state1 is called. This works fine but I also have a back mousearea that returns to the previous state (base state) when the back mousearea is clicked the animation is called again but to return the image to its original state. The problem is state1 is called again after the animation is completed.

    how can I do something like
    @
    ....
    onRunningChanged: if(!running && !"rotated_back") page.state = 'State1'

    ...@

    here is the code which pertains to my issue.

    @
    Image {id: image6; x: 59; y: 33; width: 100; height: 100; source: "images/mm.png"
    states: State {
    name: "rotated"
    PropertyChanges { target: image6; rotation: 180}
    }
    State{
    name: "rotated_back"
    PropertyChanges { target: image6; rotation: 180 }

                       }
                transitions: Transition {
                           RotationAnimation { duration: 1000; direction: RotationAnimation.clockwise }
                           onRunningChanged: if(!running)  page.state = 'State1'
                       }
                }
    

    ......

    MouseArea {
    id: movie_mouse_mm
    x: 392
    y: 250
    width: 104
    height: 100
    onClicked:{
    image6.state = "rotated"
    playbanner.start()
    //page.state = 'State1'
    Logic.get_db(5,0);
    }
    }
    ....
    MouseArea {id: home_mouse; x: 16; y: 31; width: 75; height: 42;
    onClicked:{
    page.state = 'base state'
    onClicked: image6.state = "rotated_back";
    }
    }
    @

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JapieKrekel
      wrote on last edited by
      #2

      Try
      @
      ....
      onRunningChanged: if(!running && (image6.state !== "rotated_back")) page.state = 'State1'

      ...
      @

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dstudentx
        wrote on last edited by
        #3

        You sir are amazing.

        1 Reply Last reply
        0

        • Login

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