How to implement smooth QGraphicsView :: centerOn (QGraphicsItem)?

I have a descendant QGraphicsItemcalled lnk, and I use this code to move the graphical representation directly to its location in the scene:

ui->graphicsView->centerOn(lnk);

Now I would like the view to scroll smoothly to the location of the element (for example, to Google maps).

In google and stackoverflow searches, I found some solutions, but all of them are based on the old API and are not so clear to me.

For example, this one: Make QGraphicsView do a smooth centerOn based on the old API, and the source code is incomplete. This is also deprecated: http://www.qtcentre.org/threads/30970-QGraphicsView-centerOn()-with-smooth-scrolling

Please help me understand how I can get this using the new API (I think I should use the QPropertyAnimation object)?

+3
source share

All Articles