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. QGraphicsView improper animation
Qt 6.11 is out! See what's new in the release blog

QGraphicsView improper animation

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 686 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.
  • D Offline
    D Offline
    david.luggen
    wrote on last edited by
    #1

    Hey there,

    I'm working with the QGraphicsView and QGraphicsScene. Until now, I was just setting up a static scene with some basic functions that allow to move and scale items. Now I tried to set up a simple animation where an item starts to move around. I searched for some tutorials and examples and found out, that there are a lot of suggestions to just setup a QTimer and refresh the position of the item every timeout.

    So I did this and adjusted the timer interval to about 16ms which should match more or less to the monitor refresh rate at 60Hz. First question here, is there any possibility to match the animation to the exact refresh rate of the monitor?

    The moving item, a simple QGraphicsRectItem, is moved in front of a QPixmap. But although I set the ZValue of the rectangle to the front, it disappears from time to time during the animation. The animation seems to be kind of instable at all, so if I move the scene around with the scrollbars, the moved item starts generate a tail of old positions of the item.
    So here is where I start to ask myself, is there a better way to do simple animations like moving an item around the scene?

    As always, I appreciate any kind of help very much!

    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