Edit:
The apparent answer: Yes there was a path error involved, as simple as that.
--
Hej,
In short I am attempting to load a png image from file:
bool loaded = pixmapSrc.load("pixmaps/ps1.png");
std::cout << "image loaded = " << loaded << std::endl;
pixmap.setPixmap(pixmapSrc);
QPixmap pixmapSrc;
QGraphicsPixmapItem pixmap;
bool loaded = pixmapSrc.load("pixmaps/ps1.png");
std::cout << "image loaded = " << loaded << std::endl;
pixmap.setPixmap(pixmapSrc);
To copy to clipboard, switch view to plain text mode
result: image loaded = 1
It works fine, the image loads and is presented properly on my Scene etc.
In other functions of the same class I am able to change the pixmapSrc by repeating the above step with another source file (e.g "pixmaps/ps2.png") and the scene is updated with the new image.
Now, to my issue:
I am not able to load any new images in the same fashion.
bool loaded = pixmapSrc.load("pixmaps/xyz.png"); //new image
std::cout << "image loaded = " << loaded << std::endl;
pixmap.setPixmap(pixmapSrc);
bool loaded = pixmapSrc.load("pixmaps/xyz.png"); //new image
std::cout << "image loaded = " << loaded << std::endl;
pixmap.setPixmap(pixmapSrc);
To copy to clipboard, switch view to plain text mode
result: image loaded = 0
At first I thought there was something wrong with the images themselves so I renamed an image I had previously confirmed OK and gave it a new name, and it won't load.
I'm obviously missing something along the way (I've changed my IDE to QT Creator recently, but if there was a config problem, why does the other images work?)
Thanks
Bookmarks