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. How do I add a wait for an animation to be completed?
Forum Updated to NodeBB v4.3 + New Features

How do I add a wait for an animation to be completed?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 820 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.
  • A Offline
    A Offline
    Ankit.Jain
    wrote on last edited by
    #1

    Hi,

    I have an animation for hiding a menu. I want that whenever I show a pop-up; the menu should hide and then the pop-up should be displayed.

    I am looking for a way to pause / wait for the animation to complete before I continue with the code.
    I am also quite new to QML, so most of its qualities escape me.
    The animation for the menu closing is called in multiple places. I am also pressed for performance, so adding a signal at the end and checking with a variable is something I want to avoid.

    Thanks

    1 Reply Last reply
    1
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      There are several ways to do this.

      First, you can add the code you want to execute later to onFinished slot in your animation:

      Animation {
        onFinished: console.log("Something")
      }
      

      Or you can use onRunningChanged if you prefer.

      Another possibility is to set up a sequential animation:

      SequentialAnimation {
        Animation {
          // This is your current animation
        }
        ScriptAction {
          script: console.log("I'm executed after animation ends")
        }
      }
      

      (Z(:^

      1 Reply Last reply
      3

      • Login

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