Re: [Interest] file:// is harshing my zen
> > > > if (uri.scheme() == "file") > > Better: > if (uri.isLocalFile()) > > QUrl caches internally whether the scheme() is "file", so there's no string > comparison. Thanks Thiago, that's good to know! ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] file:// is harshing my zen
> >> Caveat: I don't use QML. If that's giving you QString's that really > >> should be QUrl's, I'd be complaining about that... > > > > It does. > > Can you elaborate more about your scenario? Do you have a property of > type QString (string in QML) and you're assigning a value of type QUrl > (url) to it? Camera { videoRecorder { actualLocation } } it also happens on Camera { imageCapture { preview } }. But on image capture, it is using a QQuickImageProvider, so the scheme is actually useful. Meanwhile all the recording backends seem to be optimized for, and are only capable of, writing to files. It would be really cool if I could specify a storage provider with the scheme. Like: encrypted://file where it uses my provider to read/write a provider that implements a QIODevice interface. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] file:// is harshing my zen
On Wed, Dec 16, 2015 at 8:23 PM, Jason Hwrote: > It means that I would not have to have an instance of a QUrl class. Currently > I'd have to do: > QUrl url(string); > return url.toLocalFile(); > > Why can't I just do QUrl::toLocalFile(string) I shouldn't need an instance to > strip file:// if it exists. Or QUrl(foo).toLocalFile()... > >> Caveat: I don't use QML. If that's giving you QString's that really >> should be QUrl's, I'd be complaining about that... > > It does. Can you elaborate more about your scenario? Do you have a property of type QString (string in QML) and you're assigning a value of type QUrl (url) to it? Cheers, -- Giuseppe D'Angelo ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] file:// is harshing my zen
On Wednesday 16 December 2015 17:33:54 Jason H wrote: > Why isn't there a *static* QUrl::toLocalFile()? Why would you need one? QUrl("file:///tmp/Mambo %235.mp3?seek=60").toLocalFile() == QString("/tmp/Mambo #5.mp3") -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] file:// is harshing my zen
On Wednesday 16 December 2015 12:27:28 Matthew Woehlke wrote: > Well, you mentioned toLocalFile, so I assume you already know that "trim > it" should actually use that. Also: > > if (uri.scheme() == "file") Better: if (uri.isLocalFile()) QUrl caches internally whether the scheme() is "file", so there's no string comparison. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] file:// is harshing my zen
I continually run into situations in QML where I'm being given a Url. Normally these are file://... When I take my C++ api, expose it to QML and pass these values from QML to the C++ api, things don't work, and as a result I have to add if (filename.startsWith("file://")) {..trim it...} everywhere. This is harshing my Qt zen. Am I just not groking something simple? Why cant QFile see "file://" and handle it? Why isn't there a *static* QUrl::toLocalFile()? I realize that when you use things like an image provider, that the protocol matters. But it would be really cool if QFile and other classes could just take a URL that protocol and run it through appropriately, so I can QFile f("imageprovider://some/file"); f.open(QIODevice::ReadOnly); f.read()... Usually things in Qt are pretty zen. So I suspect I'm missing something obvious. Or am I just head of the curve for once? ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] file:// is harshing my zen
Hello Jason H, I agree with you. I got the same problem you got a lot of times. There is a clearly incongruence and came out when you try to pass thing between Qt C++ to/from QML. I really hope that Qt developers fix all these issues of passing URL around all Qt C++ classes and QML items. Ciao, Gianluca. Il giorno 16/dic/2015, alle ore 16:33, Jason Hha scritto: > I continually run into situations in QML where I'm being given a Url. > Normally these are file://... When I take my C++ api, expose it to QML and > pass these values from QML to the C++ api, things don't work, and as a result > I have to add if (filename.startsWith("file://")) {..trim it...} everywhere. > This is harshing my Qt zen. Am I just not groking something simple? Why cant > QFile see "file://" and handle it? Why isn't there a *static* > QUrl::toLocalFile()? I realize that when you use things like an image > provider, that the protocol matters. But it would be really cool if QFile and > other classes could just take a URL that protocol and run it through > appropriately, so I can QFile f("imageprovider://some/file"); > f.open(QIODevice::ReadOnly); f.read()... > > Usually things in Qt are pretty zen. So I suspect I'm missing something > obvious. Or am I just head of the curve for once? > ___ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest