I want to save all items in a QGraphicsScene to a file. When I load the file, I should be able to use them as QGraphicsItems(as before). I keep my items in a QList like QList of QGraphicsItems that i called mItemsOnScreen. I should be able to get back that list when i load the file.How can I save those items to a file on disk. What kind of a file format should i use? And of course how will i read that file back?Please Some Help...And Thank's in advance.
I already do this but it save image format:
void MainWindow::loadImage(){ QString fichier = QFileDialog::getOpenFileName(this,
tr("Open Image"), "C:/", tr("Image Files (*.png *.jpg *.bmp)"));
if(fichier != "")
{
//QGraphicsView *vue = new QGraphicsView(scene);
QPixmap monPixmap(fichier);
scene->addPixmap(monPixmap);
if(monPixmap.load(fichier))
QMessageBox::information(0,"Chargement réussi","Le Diagrame a bien été chargé !");
else
QMessageBox::critical(0,"Erreur de Chargement","Le Chargement du Diagrame a échoué !");
} }