【发布时间】:2016-06-06 05:21:18
【问题描述】:
我在资源文件中有一些图片,它们的文件名对应于它们的staffIds。这就是我将图片设置到我的QLabel 中的方式,但没有显示任何内容。
QString staffId;
staffId=ui->lineEdit_staffID->text();
QPixmap managerPic(":/staff/\'"+staffId+"\'.jpg");
managerInterface.ui->label_mpic->setScaledContents(true);
managerInterface.ui->label_mpic->setPixmap(managerPic);
【问题讨论】:
-
为什么在
staffId字符串前后放置\'字符?您的文件名是否包含单引号字符???