Need to call repaint during animation
Something I’m doing with an animation (QPropertyAnimation) causes an artifact that can be resolved by calling repaint for the region. However a) I don’t know when the animation is complete and b) I’d like to call repaint for each step of the animation. Can anybody point me in the right direction as far as what I need to be able to do in order to be able to call repaint during an animation? Thanks
If you have direct access to the code of the class of objects you animate with QPropertyAnimation, it would be possible to call repaint in the properties write method. However I’d have a better look and try to find out why the artifacts are there (maybe an incorrect bounding rect if you are dealing with QGraphicsObjects?)
Thanks your suggestion worked.
I initially tried to override setMinimumHeight for my class that inherits QWidget so that I could call repaint from it after calling QWidget::setMinimumHeight. The minimum height is one of the properties I’m animating. However, my override was never called. I’m guessing the way the property animation works breaks any attempt of using polymorphism (or did I do something wrong implementing my override?). I ended up just adding a property to my class for the purpose of repainting and used animation groups.
The artifact is caused by the following:
I added the ability to collapse dockwidgets. (Imagine dock widgets docked to the left side. There is a button in the title bar to make them 0 height. This collapse is animated). Consider having two widgets docked to the left side. If you collapse the bottom one, the top one grows to fill the space. If you then collapse the top one, the titlebar for the bottom widget moves as the top widget shrinks. Its splitter leaves artifacts in the empty space below the titlebars. see http://i.imgur.com/xLaUE.png I think this is just a limitation of Qt.