View Full Version : How to set a specific color of a text item into a QListBox ?

17th March 2006, 08:03

The title is explicit ;)

I use quite often QListBox widget to display traces when proceeding to unitary tests of my classes. I wonder if it is possible to set the color of the text items that are inserted into the list box. For example I want to insert a text line in black, then I want the next text line to be inserted to be red or any other color.

Is it possible to do such a thing ?

Thanks in advance.

17th March 2006, 08:19
I think you must subclass QListBoxItem and reinplement his protected method paint().And then use QPainter fuctionality.