Having a QGraphicsItem always at the center of QGraphicsScene?
-
So basically, I have a bunch of QGraphicsItem objects in one scene. I can actually move just one item and I want to have that item to always be centralized to the scene. The scene is much larger than the view itself, so I want to have the camera to follow one item/object. How should I go about doing this?
-
@qtgamer
I don't think the OP really meant "I want to have that item to always be centralized to the scene". I suspect he/you meant "centralized to the view", right?In which case, move/resize the
QGraphicsView
as necessary when the target item changes position/size, e.g. maybe void QGraphicsView::centerOn(const QGraphicsItem *item).