In this recipe, you will learn how to perform different operations on list items in List Widget
. List Widget
is basically used for showing a collection of similar items, enabling the user to choose the desired items. Consequently, you need to add items to List Widget
. Also, you might require to edit any item in List Widget
. Sometimes, you might require to delete an item from List Widget
. One more operation that you might want to perform on List Widget
is deleting all items from it, clearing the entire List Widget
item. Before learning how to add, edit, and delete items from List Widget
, let's understand the concept of a list item.
List Widget
consists of several list items. These list items are instances of the QListWidgetItem
class. The list items can be inserted into List Widget
using the insertItem()
or addItem()
methods. List items may be in text or icon form and can be checked or unchecked. Methods provided by QListWidgetItem
are given...