[Interest] Should onImageSaved give a URL?

Thiago Macieira thiago.macieira at intel.com
Wed Jan 22 19:56:31 CET 2020


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.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Interest mailing list