Can't decide how to best utilize QGraphicsView's API
-
Hello,
I've been struggling to understand the best way to execute my task... Any guidance from someone experienced would be much appreciated!In my software, I plan to have a 512x512 QGraphicsView object which displays a birds eye view of a Minecraft map (like actual terrain). This map is separated into squares (called chunks), each chunk contains information about that section of the map (as well as a little picture of the unique terrain). At default zoom, 64x64 chunks are shown. The scene can be zoomed in to as close as 2x2 chunks.
The user will be able to click and drag around the map, each time loading in the new sections of the map.
So here's my idea for accomplishing this:
At first, I figured I should have 1 QGraphicsItem that redraws 1 QPixmap of the map (Always 512x512 pixels in size). And every time the item is dragged, the QPixmap should be redrawn and repositioned back to the center to give the illusion of continuous movement. (And using some logic we can only redraw the new chunks).
This makes sense to me, however, I recently came across a forum post where @wysota said that redrawing a QPixmap instead of utilizing QGraphicsView's ability to handle many items is a waste of the technology (paraphrasing). Which made me question whether my approach with the drawing/repositioning of a single QPixmap would be inferior to simple having an individual QGraphicsItem for each chunk.
My main concern is performance and memory usage. The maps can be potentially infinite, so I'm unsure the best route to take.
Thanks so much for your time!