Hello,
I'm trying to add a label as an image. So I've created a resource under Qt and added in the images, but when I try to run the code it only adds in the image if I give it the extact path and not the short version.
For example:
This works
void MainWindow::TestIOinputs()
{
QPixmap stat_GO
("C:/Qt/MyProject/images/stat_noGO.png");
ui->label_3->setPixmap(stat_GO);
}
void MainWindow::TestIOinputs()
{
QPixmap stat_GO ("C:/Qt/MyProject/images/stat_noGO.png");
ui->label_3->setPixmap(stat_GO);
}
To copy to clipboard, switch view to plain text mode
This doesn't work
void MainWindow::TestIOinputs()
{
QPixmap stat_GO
(":/images/stat_noGO.png");
ui->label_3->setPixmap(stat_GO);
}
void MainWindow::TestIOinputs()
{
QPixmap stat_GO (":/images/stat_noGO.png");
ui->label_3->setPixmap(stat_GO);
}
To copy to clipboard, switch view to plain text mode
The resource file is called images and I have added the images there. I can also see that the .pro file has the resources.qrc added in. Any ideas?
Bookmarks