Results 1 to 3 of 3

Thread: How to set QTreeView from an XML file?

  1. #1
    Join Date
    Sep 2017
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default How to set QTreeView from an XML file?

    Hi,

    I want to set QTreeView model from an XML file? I tried with Qt exemples but they are for QTreeWidget, I did not succeed to convert one of exemple to work with QTreeView(with model).

    I have an XML file like below.

    Qt Code:
    1. <root>
    2. <Folder Name="myFolder">
    3. <File Name="myFile" />
    4. </Folder>
    5. <Folder Name="mySecondFolder">
    6. <File Name="myFile2" />
    7. <File Name="myFile3" />
    8. <File Name="myFile4" />
    9. </Folder>
    10. </root>
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,249
    Thanks
    304
    Thanked 868 Times in 855 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to set QTreeView from an XML file?

    I think this example from the Qt distribution is what you need. The XML you showed above is not a properly complete XML document; it is missing the XML header information, so the DOM parser will probably reject it. Be sure you have a correct XML file.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Sep 2017
    Posts
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to set QTreeView from an XML file?

    I will try, thanks for reply.

Similar Threads

  1. Replies: 1
    Last Post: 22nd July 2015, 23:01
  2. How to display Details of Audio File in QTreeView
    By owais_blore in forum Qt Programming
    Replies: 2
    Last Post: 26th November 2012, 07:30
  3. Replies: 0
    Last Post: 20th July 2010, 15:55
  4. flush to file the QTreeview
    By rmagro in forum Qt Programming
    Replies: 0
    Last Post: 1st July 2009, 14:41
  5. qtreeview -file path
    By onder in forum Newbie
    Replies: 3
    Last Post: 12th July 2006, 10:40

Tags for this Thread

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.