[Interest] Display XML in tree view
Jason H
jhihn at gmx.com
Wed Aug 3 18:48:21 CEST 2016
> Sent: Wednesday, August 03, 2016 at 12:45 PM
> From: "Murphy, Sean" <smurphy at walbro.com>
> To: "interest at qt-project.org" <Interest at 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.
More information about the Interest
mailing list