[Interest] Decoding drag&drop file URLs under Windows with QUrl

Julien Cugnière julien.cugniere at gmail.com
Thu Jul 6 12:10:09 CEST 2017


Hello Etienne,

QUrl::path does not return a local file path, but rather the path part
of the URL, which is indeed "/C:\Users\foo\file.txt".

I think what you're looking for is QUrl::toLocalFile().
Julien Cugnière


2017-07-06 10:57 GMT+02:00 Etienne Sandré-Chardonnal <etienne.sandre at m4x.org>:
> Dear all,
>
> I'm implementing file dropping into my windows application.
>
> I retrieve the URLs via mimeData->urls() in subclassed dropMimeData
> functions.
>
> When dropping a file, QUrl::toString() returns something like this:
>
>     file:///C:\Users\foo\file.txt
>
> And when getting the path with QUrl::path(), I get:
>
>     /C:\Users\foo\file.txt
>
> which is not valid
>
> So it seems the file:/// triple slash windows format is not parsed properly.
> Is this a QUrl windows bug? I'm using Qt 5.6.2
>
> Thanks,
>
> Etienne
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list