Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.7.0
-
None
-
Windows 10 update 1607, Qt 5.7.0 mingw
-
cc517d7cd983d9444e9690353ea7ca7ee30740ef (qtbase/5.6, 16.8.2016, 5.6.2)
Description
Using Qt 5.7.0 on Windows 10.
I create an URL using fromLocalFile(), then I add a fragment using setFragment(). The method toString() shows that the fragment is correctly used in the URL.
Then, I call QDesktopServices::openUrl() on this URL. In the browser, the URL misses the fragment. This has been tested with Firefox and IE as default browsers with the same result.
Example:
#include <QApplication> #include <QDesktopServices> #include <QUrl> #include <QtDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QUrl url(QUrl::fromLocalFile("C:\\Temp\\qtlmovie-user.html")); url.setFragment("tabTools"); qWarning() << "Qt:" << qVersion() << "URL:" << url.toString(); bool ok = QDesktopServices::openUrl(url); qWarning() << "openUrl returned" << ok; }
Display:
Qt: 5.7.0 URL: "file:///C:/Temp/qtlmovie-user.html#tabTools" openUrl returned true
In the address bar of the browser, we see:
file:///C:/Temp/qtlmovie-user.html
The transmitted URL has no trailing "#tabTools" and the display is at the top of the page, not at the target anchor.
Attachments
Issue Links
- relates to
-
QTBUG-14460 QDesktopServices::openUrl() ignores anchor on local files.
-
- Closed
-
For Gerrit Dashboard: QTBUG-55300 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
167987,2 | QWindowsServices::openUrl(): Don't convert URLs with fragments/queries to local files | 5.6 | qt/qtbase | Status: MERGED | +2 | 0 |