Results 1 to 5 of 5

Thread: Problem with Model/View

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    91
    Thanks
    60
    Qt products
    Qt4
    Platforms
    Windows

    Talking Problem with Model/View

    I have parsed an XML file and got this,
    Qt Code:
    1. class Element
    2. {
    3. public:
    4. Element(const QString &type)
    5. :ElementType(type)
    6. {
    7. content.clear();
    8. }
    9.  
    10. ~Element(void) {}
    11.  
    12. void addContent(const QString str);
    13. void addSubElement(Element* element);
    14. void addAttr(const QString attr, const QString value);
    15. void toText(QTextStream &os, int level); //print for testing
    16.  
    17. private:
    18. QString ElementType, content;
    19. QList<Element*> list_subElement;
    20. QMap<QString, QString> map_attr;
    21. };
    To copy to clipboard, switch view to plain text mode 
    ElementType represents the name of the tag, content represents the value of this tag,
    every element also has many attribute-value pair, which are represented by the QMap,
    the child element is represented by the QList<Element*>

    For this simple XML file:
    [HTML]<Class No.="02">
    <Student No.="0215">Mike Jasen</Student>
    </Class>[/HTML]

    My Problem is:
    I want to show the Element and child elements in a tree-view. If any element is clicked in this tree-view, the attribute-value pairs can be shown in the table-view. How can I implement this?
    This pic is want I want, I draw it using photofiltre
    Attached Images Attached Images

Similar Threads

  1. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 09:52
  2. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Qt is a trademark of The Qt Company.