Unsolved How can I load an image?
-
I am in QtCreator 3.5.1 open source and I cannot open an image into the MainForm.ui.qml. I placed the image in the window by using the QtCreator Designer... I get the error:
QML Image: Cannot open: qrc:/horizontalpercentbarseries-icon.png
What could be happening?
Thanks
Juan -
have you checked if the path is correct?
-
@jdent said:
I am in QtCreator 3.5.1 open source and I cannot open an image into the MainForm.ui.qml. I placed the image in the window by using the QtCreator Designer... I get the error:
QML Image: Cannot open: qrc:/horizontalpercentbarseries-icon.png
What could be happening?
Thanks
JuanHi Juan,
This is the way I used:
1- Open your project in Qt creator IDE and switch to the Projects mode.
2- Right click on the MainForm.ui.qml and click on Show in Explorer. The Windows explorer opens (I assume you are using a Windows machine).
3- Copy your image and paste it into that window.
4- Get back to your IDE and double click on MainForm.ui.qml. It takes you to IDE Designer.
5- Go to Library mode and then click on Resources. Your image is there! Drag and drop it into your main window.
Hope this helps. :-) -
the file is in resources but it STILL refuses to load..
qrc:/MainForm.ui.qml:27:5: QML Image: Cannot open: qrc:/horizontalpercentbarseries-icon.png
Any ideas?
Thanks,
Juan -
Can you please take a screenshot of you screen showing Projects and Resources in Design mode?
-
Screen shot of Design mode: (file:///Users/juandent/Desktop/Qt.jpg)
Does it help?
Thanks
Juan -
Sorry, but how can I put the screenshot here?
-
Hi @jdent
Upload it at http://postimage.org/ here share the link. Or do share through dropbox .
-
-
Hi @jdent
Be sure that you have your image and qml file are in resource (*** .qrc).
And code :Image
{
source: "images/imageName.png"