Results 1 to 6 of 6

Thread: Convert Html content into QStandardItemModel

  1. #1
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Convert Html content into QStandardItemModel

    Hi,

    Is there any class where I can directly match the xml contents into QStandardItemModel ? Or do i need to do it by QDomDocument? Thanks for your help.

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

    Default Re: Convert Html content into QStandardItemModel

    Why do you want to convert one model to another one? Isn't it better to write a model that will operate directly on the xml structure?
    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.


  3. #3
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Convert Html content into QStandardItemModel

    Actually I need to parse the webpage, extract table, and need to do processing on the contents of it. May be display it as tablemodel, treemodel.

    Now, I am following the straight forward approach of loading the html page using QDomDocument and trying to parse using node, elements. I am trying figure out is there any more elegant way of doing this.

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

    Default Re: Convert Html content into QStandardItemModel

    So what good would it bring to have a model?
    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.


  5. #5
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Convert Html content into QStandardItemModel

    Quote Originally Posted by wysota View Post
    So what good would it bring to have a model?
    So, I can directly set a model for the tableview, Instead of adding item by item. Right ?

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

    Default Re: Convert Html content into QStandardItemModel

    Yes, that's true. But you don't have to copy the data anywhere. If you have the data somewhere (like in the xml document) just wrap the data in the QAbstractItemModel interface. If you're only after showing the data then Qt comes with an example that creates a read-only model around QDomDocument.
    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. Detecting finished download of HTML content for QWebView
    By TropicalPenguin in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2011, 20:44
  2. Convert html to bbcode
    By abrahametalero in forum Newbie
    Replies: 1
    Last Post: 2nd March 2011, 23:14
  3. convert ampersand encoded HTML into something readable
    By tetsuoii in forum Qt Programming
    Replies: 5
    Last Post: 24th October 2010, 19:49
  4. How to convert text to HTML in QTextEdit
    By Roszko in forum Newbie
    Replies: 5
    Last Post: 31st December 2009, 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.