Results 1 to 2 of 2

Thread: Saving QGraphicsScene? Is it Possible?

  1. #1
    Join Date
    Oct 2012
    Posts
    32
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Saving QGraphicsScene? Is it Possible?

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Saving QGraphicsScene? Is it Possible?

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 8th September 2012, 05:08
  2. Saving / Loading a QGraphicsScene with QXmlStream
    By lgb3 in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2011, 17:18
  3. QPainter error saving an image from a QGraphicsScene
    By cydside in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2010, 04:53
  4. Saving as XML
    By rakkar in forum Newbie
    Replies: 2
    Last Post: 30th October 2009, 17:17
  5. Saving QGraphicsScene with OpenGL to image
    By elbaschid in forum Qt Programming
    Replies: 1
    Last Post: 12th March 2009, 20:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.