[Interest] Should onImageSaved give a URL?
Fabrice Mousset | GEOCEPT GmbH
fabrice.mousset at geocept.com
Thu Jan 23 09:40:27 CET 2020
Hello,
I found this documentation entry very interesting about url vs string handling in QML/JavaScript
https://doc.qt.io/qt-5/qml-url.html
BR
Fabrice
> -----Ursprüngliche Nachricht-----
> Von: Interest <interest-bounces at qt-project.org> Im Auftrag von Jason H
> Gesendet: Mittwoch, 22. Januar 2020 21:53
> An: "Jérôme Godbout" <godboutj at amotus.ca>
> Cc: Thiago Macieira <thiago.macieira at intel.com>; interest at qt-project.org
> Betreff: Re: [Interest] Should onImageSaved give a URL?
>
> Wow. So in the intervening tie between replies I did some searching and
> thought this was a face-palm moment, but not event the experts know
> about Qt.resolvedUrl() https://doc.qt.io/qt-5/qml-qtqml-
> qt.html#resolvedUrl-method
> image.souce = Qt.resolvedUrl(path);
>
> So I'll save the face-palm for another time. I'm still not sure why
> onImageCaptured isn't using a url?
>
>
>
> > Sent: Wednesday, January 22, 2020 at 3:07 PM
> > From: "Jérôme Godbout" <godboutj at amotus.ca>
> > To: "Thiago Macieira" <thiago.macieira at intel.com>,
> > "interest at qt-project.org" <interest at qt-project.org>
> > Subject: Re: [Interest] Should onImageSaved give a URL?
> >
> > For Qml make a c++ function something like: Q_INVOKABLE static QUrl
> > makeUrl(const QString& path); It the easiest and reusable helper function
> for Qml, we do have a FileSystemHelper , since JS is not great to manipulate
> path and files.
> >
> > -----Original Message-----
> > From: Interest <interest-bounces at qt-project.org> On Behalf Of Thiago
> > Macieira
> > Sent: January 22, 2020 3:00 PM
> > To: interest at qt-project.org
> > Subject: Re: [Interest] Should onImageSaved give a URL?
> >
> > On Wednesday, 22 January 2020 11:00:41 PST Jason H wrote:
> > > > > onImageSaved: {
> > > > > var url = "file://"+path;
> > > >
> > > > NEVER construct a URL like this.
> > >
> > > Then how should it be done?
> >
> > I don't know about QML/JS, but in C++ use QUrl::fromLocalFile. There must
> be something equivalent in JS.
> >
> > --
> > Thiago Macieira - thiago.macieira (AT) intel.com
> > Software Architect - Intel System Software Products
> >
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > https://lists.qt-project.org/listinfo/interest
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > https://lists.qt-project.org/listinfo/interest
> >
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
More information about the Interest
mailing list