-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
Qt Creator 4.1.0
-
None
-
Distro: Ubuntu 17.04
CPU~Dual core Intel 5Y10 (-HT-MCP-) speed/max~799/2000 MHz
Kernel~4.10.0-37-generic x86_64
Upon further investigation, this looks like a problem with the Design preview system - namely, it's either a bug or a sorely needed feature, because right now the preview pretends that everything's working alright when it's not. At the least, the preview should have some speech-bubble/tooltip thing that says "hey, this image won't actually display because you haven't added it to the QRC [or whatever the correct explanation of what's wrong with it is]".
This is the problem/reproduction steps:
In a qtquick project, with the Design section (the ctrl+3 thing), I create an image from the "QML Types" thing, then click the '[...]' next to "source", which comes up with a list of files in the project's file directory. I select an image that I've previously added to my project (but NOT to the .qrc, since I didn't know that was even necessary before I typed this whole bug-report out then went looking for details).
The Design centre-pane displays the image correctly, but when I hit ctrl+R, the images are not displayed in the app.
It prints the following error message in console:
qrc:/MainForm.ui.qml:57:13: QML Image: Cannot open: qrc:/guardcat.jpg
And the MainForm.ui.qml's autogenerated source is this:
source: "guardcat.jpg"
But when I change it to the below, the image displays correctly when run.
source: "file:/home/me/Projects/ControlSchemeEditor/guardcat.jpg"
The .jpg is in the same file directory as the MainForm.ui.qml, but is in a different 'Project folder' - MainForm.ui.qml is in the 'resources folder, in the 'qml.qrc' folder/file thing. I tried adding/moving the image to the 'resources' folder, but could not do so (and I presume isn't something you're supposed to do, since there's no option to do it and resources seems to be dedicated to .q* files) So I can't see why the autogenerated version doesn't work.
Copying the image into the build folder (next to the executable) and then manually running the executable on the commandline results in the exact same error message. Although if that were the solution, there should be some sort of warning or indication that only some files are put into the build folder, anyway.
Adding the file to the 'qrc' file/folder thing finally did the trick. But I only figured THAT out after a hefty lot of googling (and typing out this entire bug report, barring that first paragraph), so if nothing else, I think this is a design/UI failure - there should be SOME indication to tell you what you need to do!