I have a problem with loading QPixmap from Qt Resources on Windows 8. I added image pawn.png (with resource editor from Qt Creator) which is in project's directory. Resource editor file res.qrc is in the same place as image. Here is the content:
<RCC>
<qresource prefix="/">
<file>pawn.png</file>
</qresource>
</RCC>
The code for loading image:
QPixmap pawn;
if(!pawn.load("://pawn.png"))
std::cout << "Can't load image" << std::endl;
scene->addPixmap(pawn);
There is always printed "Can't load image". I've tried probably all slash/backslash combinations in image path, nothing works. The one above is generated with right clicking in Resource Editor on image and "Copy Resource Path to Clipboard". Can anyone help?


Reply With Quote


Bookmarks