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?
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?
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 QStyledItemDelegateand QItemDelegate
Bookmarks