Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QPropertyAnimation: How to move a widget ?
Forum Updated to NodeBB v4.3 + New Features

[Solved] QPropertyAnimation: How to move a widget ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 8.0k 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.
  • S Offline
    S Offline
    Sam
    wrote on last edited by
    #1

    I have a requirement where I need to move the widget from one position to the other with some animation effect.
    For eg: I need to move my widget from (10,0) to (150,0) and then back to (10,0)

    How to implement this.

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sidewinder
      wrote on last edited by
      #2

      It's a matter of creating "QPropertyAnimation":http://qt-project.org/doc/qt-4.8/qpropertyanimation.html instance, setting endValue and/or keyframes, duration and starting animation. There is an example in QPropertyAnimation docs. If there is more animations involved you may consider using "State Machine Framework":http://qt-project.org/doc/qt-4.8/statemachine-api.html.

      "Never memorize what you can look up in books."
      Albert Einstein

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sam
        wrote on last edited by
        #3

        Thanks for the help,

        I got the solution and its working. I used two QPropertyAnimations one from (10,0) to (150,0) then another from (150,0) to (10,0) when first animation is finished.

        Regards
        Soumitra.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sidewinder
          wrote on last edited by
          #4

          In that case, you could also use keyframes and only one QPropertyAnimation. Check second example: http://qt-project.org/doc/qt-4.8/animation-overview.html#animating-qt-properties

          "Never memorize what you can look up in books."
          Albert Einstein

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sam
            wrote on last edited by
            #5

            Thankd for the help again.

            Can you tell me where can I find more examples on State machine and QPropertyAnimation.

            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