Multicolored text for tree/table/list items?
-
wrote on 19 Aug 2011, 15:02 last edited by
What is the fastest way to make the text of a tree item multicolored?
Like this: <black>Text</black><red>123</red>
I did some googling and found QStyledItemDelegate?
I don't see how to set the colors for regions though.
Do the items support html?Thank you!
-
wrote on 19 Aug 2011, 15:05 last edited by
By default: no. I have some code lying around that can do it, but it is not ready to be released. Vote for the associated "bug report":https://bugreports.qt.nokia.com/browse/QTBUG-14200 please.
-
wrote on 19 Aug 2011, 15:30 last edited by
Nuts. That would have been great to have.
If it become important, I think I can put a solution together using a QStyledItemDelegate.
I went to vote, but I guess they use different credentials so I have to create an account. -
wrote on 22 Aug 2011, 10:02 last edited by
The following "FAQ ":http://developer.qt.nokia.com/faq/answer/how_can_i_modify_the_color_for_individual_words_for_items_in_a_view provides an example that illustrates how this can be done by reimplementing "QItemDelegate::paint":http://doc.qt.nokia.com/latest/qitemdelegate.html.
-
wrote on 22 Aug 2011, 10:17 last edited by
I don't think the solution presented in that FAQ is very usable. Nice if you want to render one fixed word in a fixed color, but it does nothing to support rendering actual rich text in an item view.
1/5