PDA

View Full Version : QDesktopServices::openUrl and HTML fragments



roro
18th June 2007, 11:13
Hi,

I've got a problem with QDesktopServices:: openUrl when I want to open an Url containing a fragment like in this link (#openUrl) :
http://doc.trolltech.com/4.2/qdesktopservices.html#openUrl

I create my QUrl, I call setFragment("openUrl")
When I display my QUrl.toString(), I get the correct url;
but when I call the QDesktopServices:: openUrl,
the browser receives an Url where the # is encoded to %23... I don't want that ! I expected the fragment not to be encoded...
How can I do to forbid the # encoding ?
Thanks :)

roro
18th June 2007, 17:00
Hum in fact this problem is only for local files when we don't give the schema "file://" explicitly.
In this case, QUrl adds "file://" correctly but transcode # at the same time.

wysota
18th June 2007, 17:31
You should probably use QUrl::fromLocalFile().