Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.1
-
None
Description
Using pdfviewer example program is is not possible to load any pdf, by using open file dialog.
As command line parameter you can use \Users\Gunnar\Downloads\bla.pdf, but c:\Users\Gunnar\Downloads\bla.pdf will not work.
This is due to this code:
void QQuickPdfDocument::setSource(QUrl source) { if (m_source == source) return; m_source = source; m_maxPageWidthHeight = QSizeF(); emit sourceChanged(); if (source.scheme() == QLatin1String("qrc")) m_doc.load(QLatin1Char(':') + source.path()); else m_doc.load(source.path()); }
I found QTBUG-6868 which was claosed a invalid.
QUrl ( const QString & url ) / path() problem on windows for local files
QUrl q("file:///c:/tmp/test.txt")
qDebug() << q.path();
will result as a path: /c:/tmp/test.txt
This was commented:
tmacieir added a comment - 26 Dec '09 20:10
There's nothing wrong with the implementation. QUrl::path() returns the path component of the URI. No one ever promised that it was a valid file path on the filesystem.
416365416c added a comment - 16 Sep '13 18:41
Note that to get a valid path, you can use toLocalFile() instead of path().
But I think this behaviour really should be documented as also experienced Qt programmers like Shawn Rutledge do not know about this.
It also seems to me not many people use the pdf module on windows as this bug was not detected earlier.
Attachments
Issue Links
- resulted from
-
QTBUG-6868 QUrl ( const QString & url ) / path() problem on windows for local files
- Closed