Important: Please read the Qt Code of Conduct -

Saving the current state of a QGraphicsScene.

  • Hi ,
    I need to implement a saving feature in my application .Let say that a user opens the application,draws to rectangles on the scene and quits.The new feature would allow him to save the current state of the scene so that it can loaded when the application is run again.

    Is there a way this can be easily achieved in Qt?

  • Hi!
    At first, get all items:
    @QList<QGraphicsItem *> QGraphicsScene::items ()@
    then, you can save parameters of items as you wish.
    Usually i use QDomDocument.

  • Thanks qxoz,you really saved me some time!
    QDomDocument ,here I come!

  • You're welcome.
    I am glad to be helpful :) .

Log in to reply