Unsolved Tiling with QGraphicsItems
-
When a QGraphicsItem is not being displayed (there is no exposed rect) does the GraphicsItem take up ram? I am trying to implement tiling into a program that could have as man as 500 250X250 tiles, while the tiles themselves could also get scaled larger or smaller. If I were to add all of the tiles/graphicsItems to the scene, would Qt take care of most of the rendering? So when an items coordinates are displayed in the QGraphicsView window it will paint/render the tile, and if it is not displayed in the QGraphicsView window the prorgam automatically clears up memory. I saw mention of one system where the only items ever being painted are what is in the exposed rect of the QgraphicsItem. As performance effective and impressive as this is, I don't think I'll have the time to program a system such as this. It would involve writing a new class that inherits QGraphicsItem and redefining all the virtual functions to go along with it.
-
Hi
Yes, the actual QGraphicsItems will take up memory once created.
The culling part only makes it not draw, its not deallocated.Did you see the 40.000 items sample?
http://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.htmlDid you try with the needed amount of tiles ?
Is performance or memory usage an issue?
Before design the best solution, you should test a bit first to see what is needed memory wise etc. -
the problem is is that I have very limited development time, so I almost need to choose a method and make it work in whatever way is possible.
-
@brazz
Then just go for it.
Might need a tons of RAM but should work fine otherwise.Alternatively use a tiling engine
https://github.com/jsykes/million-tile-engine
if you are making a game kind of app.