PDA

View Full Version : Saving QGraphicsScene? Is it Possible?



steadi
17th October 2012, 15:56
Hello again,

Thanks for all the support from these forums, like i mentioned in an earlier post - The amount of support is unbelievable and I have come a long way in Qt. I have a slightly harder question than in my previous posts and it is: "How do i save a qgraphicsscene or a qgraphicsview?"

I need to save a QGraphicsScene with a bunch of items on and then load it up again when i choose. How would I go about doing this - Could somebody please help out or point me in the correct direction?

Thanks in advance guys,
Matt

wysota
17th October 2012, 16:49
Iterate over all items in the scene recursively and save them using your own custom serialization function that takes into consideration the characteristics. To load do the opposite, go through the serialized data and create appropriate items according to the data your read. You might also want to save the scene size.