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. QDom coloring
QtWS25 Last Chance

QDom coloring

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 3.2k Views
  • 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.
  • L Offline
    L Offline
    linoux
    wrote on last edited by
    #1

    Hi i'm handling somme xml files with QDom and i want to color some of the QDomNode on some conditions but i didn't find any thing about the color in QDom or in QDomNode.

    Thanks

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      XML nodes (QDomNode) do not have a color.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • L Offline
        L Offline
        linoux
        wrote on last edited by
        #3

        Is there a work around to make them look like they are colored or event highlight?

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vcsala
          wrote on last edited by
          #4

          As I understand you want to visualize an xml tree for which purpose you should use a QTreeView or QTreeWidget class (or similar). With these your question is reasonable. QDom is a data structure to store XML data therefore with those speaking about coloring is not understandable.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            linoux
            wrote on last edited by
            #5

            Yeah your right sorry i didn't explain myself properly i'm using QAbstractItemModel for the model and a custom class for the items. And i want to compare some filds in every lines of a xml files and color the ones which the comparaison return different.

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

              So if you have a custom class for the items, store the color in the custom class and return it from the data() method of your model. The background color is queried by role==Qt::BackgroundRole

              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
              • L Offline
                L Offline
                linoux
                wrote on last edited by
                #7

                Thanks Gerolf, my problem now is how to get the item knowing only the QDomNode? cause when comparing i'm working with the qDomNodes.

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

                  I don't know the internas of your program, but at some time, you create your items. and there must be some logic on how to build them. And with the same logic, it should be possible to find them.

                  That is something, you have to solve and that is not a Qt problem, more a logical one.

                  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

                  • Login

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