Results 1 to 3 of 3

Thread: Qml NumberAnimation

  1. #1
    Join Date
    Jan 2015
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Qml NumberAnimation

    Hey,
    i wrote 8 puzzle solver in C++ for gui i used QML, it works fine but when i want it to look good and i use NumberAnimation on x,y it looks good when user is moving puzzle but when algorithm is building path it can't keep up and it makes mess. I tried waiting for animation to finish
    Qt Code:
    1. while(!previousItem->property("animationFinished).toBool){};
    2. moveItem(nextItem); // not actual code
    To copy to clipboard, switch view to plain text mode 
    and then move next element but it seems that this freezes whole gui so it never finishes the animation.
    Any suggestions?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qml NumberAnimation

    Waiting for the animation to finish is not equivalent to blocking the application, which is what you are doing.

    If your application is stuck executing a while loop, it cannot do something else, right?

    Provide a slot on an object exported from C++ and call it from QML once the animation is done. Then advance in that slot.

    Cheers,
    _

  3. #3
    Join Date
    Jan 2015
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Android

    Default Re: Qml NumberAnimation

    While loop was only last thing i tried in despair,
    originaly i started with signal and slot but it didn't work so I tried something else,
    now i looked at my code with calm head and i realised i emited signal every time running state changed not only when it changed to false,
    anyway thank you very much.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.