Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9080133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:00:20+00:00 2026-06-16T20:00:20+00:00

I am trying to make visible animations sequential. I have a javascript function, which

  • 0

I am trying to make visible animations sequential. I have a javascript function, which call myModel.move() two times. I have a GridView to show myModel and I have “Behavior on x” animation, thus I can visualy see the movements. But, both movement animatons runs in paralell (the small delay between them is not noticeable).

My idea was to add a counter of how many animations was started and how many of them already finished. Something like this;

Behavior on x {
    NumberAnimation {
        id: animationX;
        duration: 500;
        onRunningChanged: {
            if (animationX.running) {
                console.log("Animation start");
                myModel.busy = myModel.busy + 1
            } else {
                console.log("Animation stop");
                myModel.busy = myModel.busy - 1
            }
        }
    }
}

This works as expected. Then, I add a loop to my javascript function to wait until all the animations finished.

ListModel {
    id: myModel
    property int busy: 0
    function doSomething() {
        myModel.move(...)
        while (myModel.busy) {}
        myModel.move(...)
    }
}

Here is the problem. I can see that after the first move() all neccessary animations started, but nothing can be seen and none of the animation finished. I have some kind of a deadlock. How to solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:00:22+00:00Added an answer on June 16, 2026 at 8:00 pm

    Here is a working solution based on the answer from #UmNyobe. Well, QML is a declarative language and thus problematic for iterative problems. Any comments are welcomed. Maybe, someone can suggest better (more readable) pure QML program which will produce the same effect.

    import QtQuick 1.1
    GridView {
        id: mainGrid
        cellWidth: 165; cellHeight: 95
        width: 5*cellWidth; height: 4*cellHeight
        model: myModel
        delegate: myButton
        property string animate: "no"
        property int busy: 0
        signal busyPlus
        signal busyMinus
        onBusyPlus: {
            busy++
        }
        onBusyMinus: {
            busy--
            if (busy == 0) mainGrid.model.algorithm()
        }
        ListModel {
            id: myModel
            property int step: 0
            property int one: 0
            function createModel() {
                for (var i=1; i<=20; i++) {
                    append({"display": i})
                }
            }
            function algorithm() {
                if (step == 0) {
                    move(0,19,1)
                    one = 0
                    step++
                }
                else if (step == 1) {
                    if (one < 19) {
                        move(one,one+1,1)
                        one++
                        if (one == 19) step++
                    }
                }
                else if (step == 2) {
                    move(0,1,1)
                    move(5,6,1)
                    move(10,11,1)
                    move(15,16,1)
                    step++
                }
            }
            Component.onCompleted: {
                createModel()
                mainGrid.animate = "yes"
                algorithm()
            }
        }
        Component {
            id: myButton
            Item {
                id: item
                width: mainGrid.cellWidth-5; height: mainGrid.cellHeight-5;
                Rectangle {
                    id: box
                    parent: mainGrid
                    x: item.x; y: item.y;
                    width: item.width; height: item.height;
                    border.width: 1
                    Text {
                        anchors.centerIn: parent
                        text: display
                        font.pixelSize: 48
                    }
                    Behavior on x {
                        enabled: mainGrid.animate == "yes"
                        NumberAnimation {
                            id: animationX;
                            duration: 1000;
                            onRunningChanged: {
                                if (animationX.running) mainGrid.busyPlus()
                                else mainGrid.busyMinus()
                            }
                        }
                    }
                    Behavior on y {
                        enabled: mainGrid.animate == "yes"
                        NumberAnimation {
                            id: animationY;
                            duration: 1000;
                            onRunningChanged: {
                                if (animationY.running) mainGrid.busyPlus()
                                else mainGrid.busyMinus()
                            }
                        }
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following interface which I'm trying to make COM-visible. When I try
I'm trying to make some div's visible on mouseover, but the code which I
I am trying to make the s_cord_print function visible in the cord_s.c file only.
I have an issue when I'm trying to make my image or label visible
I'm trying to make video output (sequence of frames) to any qt visible widget.
I am trying to make a webpage so that content will only be visible
I'm trying to check to make sure an item is visible before I start
I am fairly new to iOS development and trying make a simple app which
I'm trying to make a thumbnail toolbar button (TTB from now on)visible when the
I'm trying to create a button programmatically and make it visible. This is what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.