QListWidget* listWidget = new QListWidget(this); QListWidgetItem* item = new QListWidgetItem(QIcon(":/icons/image.png"), "Item Text"); listWidget->addItem(item);
QListWidgetItem* item = listWidget->item(0); QIcon icon = item->icon();In this example, we retrieve a QListWidgetItem from the list widget using the `item` function. We then call the `icon` function to retrieve the icon for the item and store it in a QIcon object. These examples use the Qt Gui package library.