[Interest] Qt iOS - HowTo get access to Images stored at device

ekke ekke at ekkes-corner.org
Thu Oct 26 01:15:43 CEST 2017


thanks for your detailed explanation

changed to

source: Qt.resolvedUrl("file://"+currentFile.path)

getting

QML Image: Cannot open: file://assets-library/asset/asset.PNG


hopefully someone knows the correct URL format for iOS assets-library

ekke

Am 26.10.17 um 00:27 schrieb Thiago Macieira:
> On Wednesday, 25 October 2017 14:14:50 PDT ekke wrote:
>> You're right - must be blind - Got the QFileInfo and of course then
>> QFile also can open and read the file
>>
>> now only one problem left: HowTo display this file as Image in QML ?
> I think there's a proper URL format for them. I don't know, since I don't 
> write QML code nor for any mobile platform, so this issue has never occurred 
> to me. Others may chime in.
>
> The only thing you shouldn't do is this:
>
>> source:"file://"+currentFile.path
> NEVER form URLs from file paths by concatenation. Always use 
> QUrl::fromLocalFile() [and whatever passes for QML's equivalent] to make sure 
> that special characters get quoted properly.
>
> Special characters like '?':
>
>> for Photos from assets-library I'm getting QML Image: Cannot open:
>> file://assets-library//asset/asset.PNG?id=32E17445-91B9-48FE-81C6-13D4E2F015
>> 54&ext=PNG
> Your file was called
>
> assets-library://asset/asset.PNG?
> id=32E17445-91B9-48FE-81C6-13D4E2F01554&ext=PNG
>
> The URL you formed resulted in
>
> 	host = "assets-library"
> 	path = "//asset/asset.PNG"
> 	query = "id=32E17445-91B9-48FE-81C6-13D4E2F01554&ext=PNG"
>
> Whereas if you had used QUrl::fromLocalFile, you'd have got
>
> file:assets-library://asset/asset.PNG
> %3Fid=32E17445-91B9-48FE-81C6-13D4E2F01554&ext=PNG
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171026/fd8368de/attachment.html>


More information about the Interest mailing list