Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mapping a dom tree to a table and back.
Forum Updated to NodeBB v4.3 + New Features

Mapping a dom tree to a table and back.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jc-denton
    wrote on last edited by
    #1

    I have a table view which displays parts of a DOM tree. Now to display I travel the tree and put the text to display into a grid, which is then displayed using a QAbstractTableModel. I want to make the table editable: After editing the table I need to find the DOM element which corresponds to the cell edited and update its content. I wonder what is the way to do this. Do QObjects, QDomNodes or QDomElements have some kind of unique identifier which I could use to keep track to them? Shall I use a pointer to the QDOMNodes or just store the position where in the QDomNodeLists they are?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jc-denton
      wrote on last edited by
      #2

      Just saw that QDomNode does not inherit from QObject, why? So there will be copies and pointers is not an option I guess..

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        Hi,

        first, it makes no sense to make a QDomNode a QObject. QDomNodes are simple data structures, QObject would be an unneeded overhead.

        How you reference the object is up to you. If the path to the object is unique, so no two elements with a similar path may exist, the path would be an option. But in xml, this is not required.

        Using a pointer would also be an option.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jc-denton
          wrote on last edited by
          #4

          Thanks for your answer. I just read up about the way QDomNode is implemented. It just holds a pointer to a private implementation class [1]! So I just need to keep a copy of a QDomNode.

          [1] "qdom.h":http://iguana.web.cern.ch/iguana/lxr/source/Qt/qdom.h, line 222

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved