[Interest] Display XML in tree view

Jason H jhihn at gmx.com
Wed Aug 3 18:35:39 CEST 2016


> For bonus points, I'd love to modify the text colors for syntax highlighting tag
> names vs. attribute names vs. attribute values, etc. I don't know if how easy it
> is to have multiple colors in a single QModelIndex? A quick search says I might
> need to use a delegate for that.

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. 



More information about the Interest mailing list