diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index b8ffced6bb..c6b1a6db16 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -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(); diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp index 8d4238b553..e5392249a9 100644 --- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp @@ -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"); QSignalSpy sourceChangedSpy(browser, SIGNAL(sourceChanged(const QUrl &))); browser->setSource(QUrl("subdir/../qtextbrowser.html"));