[Qt-interest] Highlighted QTreeWidgetItem inside a QTreeWidget.

Eckhard Jokisch e.jokisch at orange-moon.de
Wed Nov 3 13:08:20 CET 2010


On Wednesday 03 November 2010 13:06:03 phil prentice wrote:
> Hi
>   I have a list of QTreeWidgetItem's inside of a QTreeWidget.  In certain
> circumstances I modify the text (for column 1) to be displayed in red i.e.
> 
> tableItem->setForeground(1, QBrush(QColor("red")));
> 
> This works great.  Unfortunately when I highlight that entry in the table
> the text is automatically converted to white with a blue background for
> all the columns. So I dont actually know that item is displyed in red.
> 
>   Is there any nice way of making the highlighted entry still have red text
> for that column(if it applies)..or is there something else you might
> recommend.
> 
> Thanks
> Phil
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

Not knowing if this will work I would suggest looking at the EditRole and 
changing the colors there. Another option would be to install a different 
delegate on that item.

Eckhard



More information about the Qt-interest-old mailing list