qDebug() << QFileInfo(":/images/123.jpg").exists();
QPixmap myPix;
myPix.load(":/images/123.jpg");
if(myPix.isNull())
{
qDebug() << "Failed to load image" ;
}
true
Failed to load image
Here is the code and output. It bothers me a lot of time.
it look like the res is corrupt... and cant be loaded.
you should verify that the res is loaded properly:
if(myPix.load(":/images/123.jpg"))
{
....
}
like in the doc stated (https://doc.qt.io/qt-5/qpixmap.html#load):
Loads a pixmap from the file with the given fileName. Returns true if the pixmap was successfully loaded; otherwise invalidates the pixmap and returns false.