View Full Version : Different foreground colors in one Row (in QTreeView)

28th November 2011, 13:23
hello everybody,

I'm wondering if it is possible to set different colors in a row of a QTreeView without splitting it in different columns.
For example I want something like this in my row:

lessons (3)

Is there a way to do this without splitting the row in different columns?

Best regards

28th November 2011, 15:27

you can use a custom delegate or make a HTML-Delegate and set HTML as Qt::DisplayRole. As for a HTML delegate search the forum or web. You will find some there...

28th November 2011, 15:46
Hey Lykurg,

Yes, that seems to be the best solution. I will try it now with subclassing QStyledItemDelegate.
Thanks for your reply :)