ui->listWidget->addItem(new QListWidgetItem(QIcon("images/line.PNG"), tr("Line")));
ui->listWidget->addItem(new QListWidgetItem(QIcon("images/rect.PNG"), tr("Rectangle")));
ui->listWidget->addItem(new QListWidgetItem(QIcon("images/oval.PNG"), tr("Oval")));
ui->listWidget->addItem(new QListWidgetItem(QIcon("images/tri.PNG"), tr("Triangle")));
图标的路径应该是 images/tri.PNG
ui->listWidget->addItem(new QListWidgetItem(QIcon("images/tri.PNG"), tr("Triangle")));
这样是动态加载图片,资源文件(qrc)中可以不添加
images路径应该放在 release 同级目录