09-26-2012 02:48 AM
Prior to the beta 3 native SDK, I was able to reference an image downloaded to the data folder by setting:
- This is no longer working for me- or there may be something else wrong, but I'm not seeing anything in my console output about it.
If the above won't work in beta 3 anymore, anyone know what would?
Solved! Go to Solution.
09-26-2012 03:07 AM
Try removing one of the levels of ".." in that.
To see the log output now, it looks like you may need to log in with SSH and use the "slog2info" command. What's working for me right now is to run "slog2info -w" as that way I can leave it running and it picks up the output from each new app.
There was a session at the Jam today which covered this (JAM10) a bit, so once the sessions are put up you may be able to learn more details from that.
09-26-2012 03:21 AM
Thanks, one level doesn't seem to be fixing it though- I'll have to try out the logging details you mentioned and see if I can glean any useful information from it.
I'm at the jam conference too- it's been awesome so far! I wasn't in the session where this topic was discussed apparently.
09-30-2012 03:38 PM
BUMP on this. Hi guys, I haven't been able to glean any good information about this from logging aside from that ".../.../.../data/myimage.jpg" no longer works in QML. Does anyone know how I can reference an image in the data folder now with beta 3? Or if that's not possible is there any way to download an image from the web, and then reference it from QML?
I have tried referencing the data folder:
09-30-2012 04:42 PM
I'm pretty sure that somewhere in https://developer.blackberry.com/cascades/document
It appears if you aren't using "asset:" then the paths should finally be rooted in the current directory, which should be the app's folder under /accounts/1000/appdata. Depending on where these images are, you could then get to them using something like "app/native/data/image.jpg" or "data/image.jpg". It seems you've probably already tried those, however, but maybe after reading that page and Data and filesystem changes and Application changes you'll figure it out.
I haven't explored this all yet. It may be that some of those changes are specific to ImageView, others to QMLDocument, and others to different things. I'll let you know if I figure it out.
09-30-2012 07:22 PM
Thanks Peter- your mention of absolute path shook something loose and I remember someone in one of the bb jam sessions mentioning something about a temporary limitation in current iteration of the OS about having to use an absolute path. I gave that a try and it is working. So I guess that may be the solution for now.
I am generating a listview data model in code and creating paths through string manipulation to the files after they are downloaded. I think it should be possible, for now, to use that to dynamically get the absolute path of the files as well, and pass them in to QML from C++ code.
09-30-2012 08:01 PM
Peter, thank you again for your help on this. I looked all through the documentation and I haven't found the information needed to sort this out. But with your help I have it working. For anyone else that this might be helpful to, here's a little more detail on the solution (for beta 3 at least) -
In native C++ code, using the relative path of "data/myimage.jpg" works if I am downloading a file and saving to my app's sandboxed data folder. However, the same can't be used when referencing the file in QML. At the moment it looks like only the absolute path of the saved file can be used in QML. Here is how I obtain that absolute path dynamically in C++ code using QT frameworks:
The resulting QString qmlPath can be passed to QML in a few ways I believe. Personally I am populating a ListView as a grid of images and so I am creating a QVariantList of QVariantMaps and using GroupDataModel passed to Listview.
10-05-2012 03:53 PM
So is there no way of getting images in QML from the data/ folder not involving C++?
Or at least any way of logging all available directories from a function in a QML file?