PDA

View Full Version : QGraphicsScene load drawing



emrares
27th August 2009, 12:25
I started playing with the Diagram Scene example. I saved my drawing intro a svg image, now i want to add a "Load drawing" function.

please give me some ideas.:confused:

Lykurg
27th August 2009, 12:39
please give me some ideas.:confused:

You could load simply the picture back in the scene (QGraphicsPixmapItem), but then you can't alter it.
So you must save all the informations about an item (like position, geometry, color..) in a self defined format to a text file. Then load that file and perform your setting to create the needed items...

emrares
27th August 2009, 13:15
10x but i need to save the drawing in a SVG format again because some other program will use this file and needs it in a SVG format.

so the question remains how do i extract the items from an SVG file and display them on the scene.:confused:

Lykurg
27th August 2009, 15:50
Ah, ok first I don't read your post right. Sorry. Now I see, svg. So, then you have no other option than interpret the xml code and transform it into graphics items, if you need the items to manipulate the diagrams.

Or

you use a svg manipulating library and perform the changes direct on the svg file and then load/refresh a QGraphicsSvgItem which holds the svg image.