> Sent: Wednesday, August 03, 2016 at 12:45 PM > From: "Murphy, Sean" <smur...@walbro.com> > To: "interest@qt-project.org" <Interest@qt-project.org> > Subject: Re: [Interest] Display XML in tree view > > > I think that's where you will need to use Roles, if you want different > > colors > > for different types of tree elements (element, attibute, cdata, text, etc) > > You'll set item.setData(color, colorRole, and the custom delegate will need > > to > > extract the color role and draw the text in that color. > > I don't think roles helps here, because if you look at how your browser > displays > the example page I linked in the previous email, there are MULTIPLE text > colors > used within a single model index. For example, if the text of an index was > <title lang="en">Harry Potter</title> > The strings "title", "lang", "en", and "Harry Potter" may each have a > different color > since they represent different things.
Depending on your needs, you could treat the attributes as items as well. Then you can have a custom delegate who would reassemble it all. If you're just hiding dext, it may be overkill, but if you want interactivity with the element attributes, it could be a better approach. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest