0
votes

I am developping a software to display the result of a simulation. I am using tiles, and since the map has several millions of tiles, I have decided not to use QGraphics abilities "to draw the entire scene, and only display the visible part" because I read it works well with thousands of tiles, not with millions of tiles.

So instead, I only display the visible part of the map (a few hundreds of tiles). It works very well. I add QGraphicsPixmapItem (=tiles) in a QGraphicsScene, and a QGraphicsView.

My problem is : how to scroll the map ? I want to move the object that contains the map (=the scene), so that all the tiles move at once. How can I do that ?

1

1 Answers

0
votes

Ok, I finally found something usefull : QGraphicsItemGroup.
What I do is that I display all the tiles of the map into a QGraphicsItemGroup, and when I want to scroll the map, I just call moveBy() on the QGraphicsItemGroup.

So, I have :
QGraphicsPixmapItem (=the tiles)
QGraphicsItemGroup (=the container of the map, that moves when we scroll)
QGraphicsScene (=the scene)
QGraphicsView (=the view)

Hope it helps ;p