PDA

View Full Version : QGraphicScene to stream



phannent
27th June 2008, 10:15
Hello,

I have an application which has a QList of QGraphicsScene's, I would like to save the scenes to a file and restore them. Can anybody show some example code of how I would do that?

Do I have to iterate through each item in the scene and send it to a QDataStream? or can I just do something like:

QDataStream out;
out << m_scenes;

Regards
Phil

mcosta
27th June 2008, 13:36
See http://doc.trolltech.com/4.4/datastreamformat.html for the complete list of all Qt types supporting data streaming.

Then you have to write code to serialize GraphicsItem and scene data

patrik08
28th June 2008, 09:43
Hello,

I have an application which has a QList of QGraphicsScene's, I would like to save the scenes to a file and restore them. Can anybody show some example code of how I would do that?
Regards
Phil



try to build:
http://www.qt-apps.org/content/show.php/GraphicsViewEdit+Layer?content=80234

and read:
http://fop-miniscribus.googlecode.com/svn/trunk/GraphicsViewEdit/include/pics_structure.h -> class SPics extended image format
and

http://fop-miniscribus.googlecode.com/svn/trunk/GraphicsViewEdit/include/richdoc_structure.h and class RichDoc to store a QTextDocument

note from an to toBase64 i choise only why i save on unknow codec db format!

i take from http://wiki.qtcentre.org/index.php?title=Using_custom_data_types_with_Qt