I'm using Qt/C++ and trying to draw a large and complex QGraphicsScene. Once I add a lot of objects, panning and zooming become unpleasantly slow. (No surprise here, of course). I've played with device coordinate caching (helps with panning to a point) and minimal viewport updates and so on, but eventually there's just too many objects. What I'd like to do is draw the items asynchronously from controlling the UI somehow. In other words, just like Google Maps does, I want to pan and zoom and let drawing catch up as fast as it's able, but to be able to pan again before the items finish drawing.
One method I'm trying is to create two QGraphicsScenes. One has the actual objects but is not attached to a QGraphicsView. The other QGraphicsScene is connected to the QGraphicsView, but it just has some tiled QPixmaps that are sized to cover the screen. The plan is to use spare CPU cycles to update any tile pixmap that needs it. This seems like it will give me the necessary control over rendering (so I don't have to block while re-rendering the entire visible scene). Thoughts? Has anyone implemented this?
Take a look here: Generating content in threads.
It sounds like this is similar to what you are trying to do. Tile mechanisms are very common ways to load in large amounts of data. Other than the link posted, I have not seen a simple example using QGraphicsView
.
40000 Chips also shows some things about managing large amounts of data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With