Results 1 to 3 of 3

Thread: RotationAnimation pause & resume

  1. #1
    Join Date
    Dec 2015
    Location
    Austria
    Posts
    23
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default RotationAnimation pause & resume

    Hi,

    I want to rotate an Image if a property is true. This is easy like this

    Qt Code:
    1. RotationAnimator on rotation {
    2. id: rotationAnimatorIconConnectionStatus
    3. target: iconConnectionStatus
    4. running: isConnectorWorking
    5. loops: Animation.Infinite
    6. duration: 2000
    7. from: 0 ; to: 360
    8. }
    To copy to clipboard, switch view to plain text mode 

    But this starts the RotationAnimation always from "0" if the running state changes. I want to rotate it from the last roation spot
    I tried following but that doesnt work. Calling pause will not pause the Animation. it keeps running (Stopping would work but again the Rotation will be start from 0 again)

    Qt Code:
    1. onIsConnectorWorkingChanged :{
    2. if(isConnectorWorking) {
    3. if(rotationAnimatorIconConnectionStatus.paused){
    4. console.log("resume");
    5. rotationAnimatorIconConnectionStatus.resume();
    6. }
    7. else{
    8. console.log("start");
    9. rotationAnimatorIconConnectionStatus.start();
    10. }
    11. }
    12. else {
    13. console.log("pause");
    14. rotationAnimatorIconConnectionStatus.pause();
    15. }
    16. }
    17.  
    18.  
    19. RotationAnimator on rotation {
    20. id: rotationAnimatorIconConnectionStatus
    21. target: iconConnectionStatus
    22. running: false
    23. loops: Animation.Infinite
    24. duration: 2000
    25. from: 0 ; to: 360
    26. }
    To copy to clipboard, switch view to plain text mode 

    Any suggestions?

    THANKS!

  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: RotationAnimation pause & resume

    Try a RotationAnimation.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    ChriD (17th February 2016)

  4. #3
    Join Date
    Dec 2015
    Location
    Austria
    Posts
    23
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: RotationAnimation pause & resume

    :-) That worked.

    Thanks!

Similar Threads

  1. Replies: 1
    Last Post: 31st May 2013, 15:29
  2. how to pause or resume a download??
    By Ali Reza in forum Newbie
    Replies: 3
    Last Post: 11th June 2012, 21:11
  3. QThread - how to pause and resume
    By xrep in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2012, 09:59
  4. how to resume QThread::wait()?
    By naturalpsychic in forum Qt Programming
    Replies: 6
    Last Post: 27th January 2011, 00:07

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.