[Interest] Should onImageSaved give a URL?

Jason H jhihn at gmx.com
Wed Jan 22 20:00:41 CET 2020



> Sent: Wednesday, January 22, 2020 at 1:56 PM
> From: "Thiago Macieira" <thiago.macieira at intel.com>
> To: interest at qt-project.org
> Subject: Re: [Interest] Should onImageSaved give a URL?
>
> On Wednesday, 22 January 2020 10:09:20 PST Jason H wrote:
> > When assigning an image element to an image capted from a Camera, it is not
> > sufficient to just assign the `path` to the source of the Image element
> > that is to display it: qrc:/main.qml:100:4: QML Image: Cannot open:
> > qrc:/var/mobile/Containers/Data/Application/8BD0A3CA-74AA-4599-BCF5-E1863AE
> > A688F/Documents/img_0010.jpg
> >
> > As can be seen, it prepends "qrc:" on to it. The fix is to prefix it with
> > "file://";
>
> All paths and URLs are relative to the current working dir (or equivalent). In
> the case of a QML file loaded from a resource, it's somewhere in qrc:/. So no
> bug in Qt.
>
> >
> > onImageSaved: {
> > 	var url = "file://"+path;
>
> NEVER construct a URL like this.

Then how should it be done?


More information about the Interest mailing list