How to move all QGraphicsObject in QGraphicsScene to center?
I have a collection of QGraphicsObject in a QGraphicsScene. At the moment of creating the QGraphicsScene, I would like to position the center of all QGraphicsObjects together as a group (i.e, keeping the relative positions of the individual QGraphicsObechts) to the center of the QGraphicsScene. Any idea how I can do this easily?
Do you mean put all your graphic objects on top of each other on the centre of the scene ? Or put them all together in one big rectangle and have that thing centred in your scene ?
I mean the latter: take all together as a group and put it centered on the scene. I thought I had it figured out with (QGraphicsScene::itemsBoundingRect()).moveCenter(QPointF(0, 0)) but this does not seem to do anything.
Can you show how you are doing it currently ?
I thought I had it figured out with (QGraphicsScene::itemsBoundingRect()).moveCenter(QPointF(0, 0)) but this does not seem to do anything.
It does something, just not what you want to ;)
itemsBoundingRect()returns a rectangle.
moveCenter()moves that rectangle. It has nothing to do with moving any objects ;)