Correctly locate files with relative paths
QUrl("relativefilename").toLocalFile() changed behavior and now returns an empty string if the scheme is not set. Setting the scheme to "file:" in setSource would however break some other assumptions in the code about relative url's. Task-number: QTBUG-22416 Change-Id: I1b3fcbef81f6e356935ec426903989e783ce9a78 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
fb631d10d0
commit
143daa6ac2
@ -153,6 +153,8 @@ QString QTextBrowserPrivate::findFile(const QUrl &name) const
|
||||
QString fileName;
|
||||
if (name.scheme() == QLatin1String("qrc"))
|
||||
fileName = QLatin1String(":/") + name.path();
|
||||
else if (name.scheme().isEmpty())
|
||||
fileName = name.path();
|
||||
else
|
||||
fileName = name.toLocalFile();
|
||||
|
||||
|
@ -250,8 +250,6 @@ void tst_QTextBrowser::viewportPositionInHistory()
|
||||
|
||||
void tst_QTextBrowser::relativeLinks()
|
||||
{
|
||||
QEXPECT_FAIL("", "QTBUG-22416: First call to QTextBrowser::setSource fails unless URL created with QUrl::fromLocalFile", Abort);
|
||||
|
||||
qRegisterMetaType<QUrl>("QUrl");
|
||||
QSignalSpy sourceChangedSpy(browser, SIGNAL(sourceChanged(const QUrl &)));
|
||||
browser->setSource(QUrl("subdir/../qtextbrowser.html"));
|
||||
|
Loading…
Reference in New Issue
Block a user