How to show icons without text in QListWidget?
问题 I want to show only icons in my QListWidget. I set text to empty string. When I select an icon I see an empty selected square on the text place. See the screenshot How can I get rid of this empty space?! 回答1: use NULL instead ui->listWidget->addItem(new QListWidgetItem(QIcon(":/res/icon"),NULL)); 回答2: How do you add an icon in your QListWidget? This should work fine (I am loading the icon from the resource file) : ui->listWidget->addItem(new QListWidgetItem(QIcon(":/res/icon"), "")); EDIT