[Interest] Animating viewable rect of QGraphicsView

Elvis Stansvik elvstone at gmail.com
Fri Mar 1 23:30:40 CET 2019

Den mån 25 feb. 2019 kl 19:54 skrev Patrick Stinson <patrickkidd at gmail.com>:
> How can I animate the viewable scene rect of a QGraphicsView using screen coordinates? This means animating both center pos and scale. This is similar to Google Earth where the map scrolls and zooms smoothly from one point to another. I have searched for an answer for this several times in the last couple of years with little success.
> The use case is that I use QGraphicsView::fitInView to show the bounding rect of all visible items. Then some items are hidden and I want to animate zooming/scrolling to fit the new bounding rect of all the items.
> Simply setting up one animation to periodically call QGraphicsView::centerOn() and another to call QGraphicsView::scale() doesn't work because calling one displaces the values of the other as the interpolation progresses.
> Thoughts? This seems like a pretty essential use case for QGraphicsView.

It was quite some time since I worked with QGV/QGS, but can't you just
have your animation update a QTransform and set that on the view with


> Thanks!
> -Patrick
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

More information about the Interest mailing list