PDA

View Full Version : QGraphicsView to follow Item?



sven-kt
20th August 2009, 10:37
Hi,

how can i make a QGraphicsView follow e.g. a QGraphicsRectItem which is movable, when i drag it outside the visible area of the view?
Right now the scrollbars appear, but the item is not focused/visible.

thanks in advance
sven

h123
21st August 2009, 14:07
Hi Steve,
I am facing the same problem, did you got any clue???

Thank you.

sven-kt
21st August 2009, 14:57
not yet steve...

aamer4yu
23rd August 2009, 15:32
How about QGraphicsView::centerOn or QGraphicsView::ensureVisible ??

sven.kts
23rd August 2009, 17:51
No, that doesnt affect the ScrollBars...

I thought of sth like connecting the scrollbars to sceneRectangle which is actually impossible..

wysota
25th August 2009, 08:40
You should be able to install an event filter on the dragged object or better yet subclass the item and reimplement its itemChange() method. In there you can get the new item position and adjust the view accordingly.