PDA

View Full Version : Hw to add a image on QlistWidget's seletced item



kellen851105
25th February 2010, 10:32
For example, I have a listwidget, when I select a list item, I want a image show just behind the selected item's text. How to implement this?

aamer4yu
25th February 2010, 12:19
Use delegates. If the item is selected, draw the image in background and then call the base class paint function.
Also you might need to give sizeHint in case you want the selected item to have a bigger height.

See QStyledItemDelegate and QItemDelegate