QListWidgetItem *item = myListWidget->item(0); item->setIcon(QIcon("path/to/icon.png"));
foreach(QListWidgetItem *item, myListWidget->findItems("important", Qt::MatchContains)) { item->setIcon(QIcon("path/to/importantIcon.png")); } foreach(QListWidgetItem *item, myListWidget->findItems("normal", Qt::MatchContains)) { item->setIcon(QIcon("path/to/normalIcon.png")); }This sets different icons for items that contain the words "important" and "normal" in their text in a QListWidget based on the images at "path/to/importantIcon.png" and "path/to/normalIcon.png" respectively. The QListWidgetItem setIcon method belongs to the Qt Widgets library.