3

I have a QGraphicsItem descendant called lnk, and I use this code to move the graphics view rect to its location into the scene:

ui->graphicsView->centerOn(lnk);

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

Looking-up with google and stackoverflow, I found some solutions but all are based on the old API and not so clear for me.

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

Please help me to understand how I can get this with the new API (I guess that I must use QPropertyAnimation facility)?

Community
  • 1
  • 1
morde
  • 231
  • 1
  • 3
  • 8
  • I don't think you should use QPropertyAnimation. Is the current scroll value a property? Maybe it is, but it seems kind of weird to me. Use QTimeLine with translate. It's not out-of-date at all. – Anthony Apr 24 '12 at 16:30
  • Anthony you are right, thankyou! QTimeLine is not deprecated, and I'll try to solve my proble with these. – morde Apr 26 '12 at 06:33

0 Answers0