Results 1 to 3 of 3

Thread: Saving Model Data to XML

  1. #1
    Join Date
    Aug 2016
    Posts
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default Saving Model Data to XML

    Hi All,

    How would I go about saving model data to a XML file? (Using QStandardItemModel and a QTableView)
    I want to write the data to a XML file when my application is closed and parsed when I open it. I'm really struggling with this.
    I have researched extensively but I can't find what I need.

    Any help would be greatly appreciated.

    Thanks.

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Saving Model Data to XML

    There's nothing built-in to do this, you'll have to traverse all of the data in the model and write out the XML you'd like using something like QXmlStreamWriter.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. #3
    Join Date
    Aug 2016
    Posts
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Saving Model Data to XML

    Thanks, I will re-read all information on QXmlStreamWriter again.

Similar Threads

  1. Saving Data as XML
    By aIsmail in forum Newbie
    Replies: 1
    Last Post: 18th November 2015, 08:14
  2. Replies: 4
    Last Post: 21st October 2013, 21:24
  3. Replies: 9
    Last Post: 14th February 2013, 19:39
  4. Replies: 0
    Last Post: 2nd November 2011, 11:13
  5. Saving hierarchical structures of data.
    By psih128 in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2009, 08:33

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.