QLabel not loading image after changing computers
-
I have a news list widget, containing a text box label and a label purely for holding an image, and I recently formated my PC and reinstalled all of my programs ( QT 5.9.2, and MSVC 2017 is what I'm using), and now after moving to my new installation, I'm randomly getting blank images in my application.
The code being used for the image is
QIcon newsIcon = QIcon(); newsIcon.addFile(thumbnailName.c_str(), QSize(200, 113)); newsItem->l_img->setPixmap(newsIcon.pixmap(newsIcon.actualSize(QSize(200, 113))));
there is a breakpoint set on the .addFile method which shows me the thumbnail name is
D:\\---\\---\\---\\data\\cache\\news\\Mysteria Teaser Image.png
A File size check that i inserted is showing the correct file size, as well as i am able to open the file normally and it is actually an image.
I've tried deleting the image and letting the program redownload them, manually downloading them, or just replacing it with a black box made in paint, and nothing i do seems to show an image, but other parts of my program using the exact same method of displaying an icon/image are working perfectly still.
These are what my QLabel image boxes are looking like
-
@SolaVitae said in QLabel not loading image after changing computers:
newsIcon.addFile(thumbnailName.c_str(), QSize(200, 113));
Why do you use c_str() here?!
-
Hi,
What do you mean by regular string ?
If it comes from the Windows API, you should then consider using QDir:: fromNativeSeparators.