Solved QTreeWidgetItem. Colored text.
-
Hi. Is there any way to use color/font tags (or another solution) for QTreeWidgetItem? Need to fill it with colored text in one column.
(Sorry for my english) -
Hi
AS @SGaist says you need to do your own drawing of that.
Funny enough it seems to be exactly the same use case :)
-
Hi and welcome to the forums.
Your English is fine.One way is to use the
QBrush b (Qt::red);
item->setForeground( 0 , b ); -
@mrjj thx.. I knew about that, but need something different. My trouble - paint "new" and "item" with different colors. For example "new" - red, "item" - blue.
-
-
Hi,
You will need a QStyledItemDelegate and do the text painting yourself.
-
Hi
AS @SGaist says you need to do your own drawing of that.
Funny enough it seems to be exactly the same use case :)
-
Thx you all.
There was hope for some built-in functionality something like setHTML... But... Ok...
Think this thread can be marked as resolved. -
Well you could add a QLabel to the cell and use its rich text capabilities but
it suffers from being non-editable and poor performance if many items.You will be much happier with the Delegate.