Where is my image?
-
I'm a total newbie at both Qt and mobile app development. I created a new Qt Quick2 application and compiled it as release on my phone. The only change I have made from the blank project was to add an image. The image doesn't show on my phone. Do I need to include some package for the image to load or something?
-
I just edited the layout in the designer tab. Other objects that I added that way showed up (albeit much smaller than in the designer view), so I was assuming that was all I had to do. Below is the code that was generated in MainForm.ui.qml. I added the image as a resource file, but it still doesn't show up.
Flickable { id: flickable x: 5 y: 202 width: 351 height: 119 Image { id: image x: 0 y: 0 width: 351 height: 119 sourceSize.height: 100 sourceSize.width: 300 fillMode: Image.PreserveAspectFit source: "myimage.png" } Text { id: text1 x: 164 y: 53 text: qsTr("Flick me!") font.pixelSize: 12 } }
-
Ok yea my guess is "myimage.png" doesn't exist on the device. You can add that image to a resource file and then reference it with something like:
Image { source: "qrc:/myimage.png" }
That should show it.
The other option is to make sure you upload the myimage.png to your application's directory on the target system. Then it should load with your existing code.