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. QPropertyAnimation and QGraphicsObject.
Forum Updated to NodeBB v4.3 + New Features

QPropertyAnimation and QGraphicsObject.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.8k 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.
  • B Offline
    B Offline
    blackbelt
    wrote on last edited by
    #1

    I was look for a list of supported QPropertyAnimation for the QGraphicsObject. I need to apply a "scale animation" to the QGraphicsObject. Is it possible?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tcampos
      wrote on last edited by
      #2

      Yes, indeed. Try something like this:

      @QPropertyAnimation *animation = new QPropertyAnimation(graphicsObject, "scale");
      animation->setDuration(animationTimeMs);

      animation->setKeyValueAt(0.0, 1.0);
      animation->setKeyValueAt(0.5, 2.0);
      animation->setKeyValueAt(1.0, 1.0);

      // You can also use interpolation:
      // animation->setEasingCurve(QEasingCurve::InOutQuint);

      animation->start(QAbstractAnimation::DeleteWhenStopped);@

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blackbelt
        wrote on last edited by
        #3

        Thank you. Indeed it is quite simple. can QPropertyAnimation used in combination with QAnimationGroup in order to translate and scale the same QGraphicsObject. I could see the scale property but nothing about translate. Should I go with the x and y properties?

        Thank you

        1 Reply Last reply
        0
        • B Offline
          B Offline
          blackbelt
          wrote on last edited by
          #4

          Another questiom @QAbstractAnimation::DeleteWhenStopped@ means that the Animation itself will deallocate from the heap when it finished, or Should I care to delete the animation instance?

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tcampos
            wrote on last edited by
            #5

            I think you can use the property "pos" or even "geometry" for that kind of operations instead of using "scale".
            Take a look at the reference:
            http://doc.qt.nokia.com/4.7/qpropertyanimation.html

            I never used QAnimationGroup but reading the reference it seems that it can be used there...

            And yes, @QAbstractAnimation::DeleteWhenStopped@ deletes the animation when finished.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blackbelt
              wrote on last edited by
              #6

              ok, thank you....

              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