[Interest] file:// is harshing my zen

Gianluca gmaxera at gmail.com
Wed Dec 16 17:38:15 CET 2015


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 H <jhihn at gmx.com> ha 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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list