Reputation: 11733
I have a QListWidget instance in the middle of my application. I want to populate it with some dynamically created QImage.
After reading the manual I have understand that i have to pass through a QIcon object. But.. How can I create a QIcon from a QImage?
I've seen an example, for instance
/Developer/Examples/Qt/itemviews/stardelegate
but it is not very useful, and around the internet I haven't found any suitable snippet.
Upvotes: 0
Views: 1281
Reputation: 37597
QListWidgetItem *item = new QListWidgetItem("something", listWidget);
itemitem->setData(Qt::DecorationRole, QPixmap::fromImage(image));
Upvotes: 4