You need to set a container for your QPixmap. I do as follows and maybe you can try
ui->label_picRange->setVisible(true); //QLabel for image was defined in mainwindow.ui
picRange
= QPixmap(":/img/picRange.jpg");
//QPixmap picRange was declared in the header if (picRange.isNull()) {
qDebug() << "Failed to load picRange.jpg";
} else {
//putting the image into the label
ui->label_picRange->setPixmap(picRange.scaled(ui->label_picRange->width(), ui->label_picRange->height(), Qt::KeepAspectRatio));
}
ui->label_picRange->setVisible(true); //QLabel for image was defined in mainwindow.ui
picRange = QPixmap(":/img/picRange.jpg"); //QPixmap picRange was declared in the header
if (picRange.isNull()) {
qDebug() << "Failed to load picRange.jpg";
} else {
//putting the image into the label
ui->label_picRange->setPixmap(picRange.scaled(ui->label_picRange->width(), ui->label_picRange->height(), Qt::KeepAspectRatio));
}
To copy to clipboard, switch view to plain text mode
Bookmarks