(1) Check whether the image is valid (or does not contain some "extras" in formatting).
(2) Try
QString file = "D:/a.png";
To copy to clipboard, switch view to plain text mode
even if you are in winblows. (Low possibility of success, the file seems to have been found.)
(3) Try
QImage image("D:/a.png");
To copy to clipboard, switch view to plain text mode
and check whether you have loaded something: image.isNull() should be false.
(4) Try
QImage image
("D:/a.png",
"PNG");
// and check image.isNull()
QImage image("D:/a.png","PNG"); // and check image.isNull()
To copy to clipboard, switch view to plain text mode
My guess is (1). The image should load by your code. Loading .png does not need any extra modules to load. Also try to load some other image, which is .png rather surely. For example, download some .png icon from somewhere.
Bookmarks