Fix import with qualifier of remote directory with qmldir
Do not skip qmldir loading when using an import qualifier and the resolved uri is remote. This makes the import behavior the same in all cases. Task-number: QTBUG-55002 Change-Id: I99d68be02ddd062e387d36946e730df076e80a8d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
6fe7ccf59b
commit
7ec1d316f4
|
@ -1452,13 +1452,10 @@ bool QQmlTypeLoader::Blob::addImport(const QV4::CompiledData::Import *import, QL
|
|||
|
||||
bool incomplete = false;
|
||||
|
||||
QUrl qmldirUrl;
|
||||
if (importQualifier.isEmpty()) {
|
||||
qmldirUrl = finalUrl().resolved(QUrl(importUri + QLatin1String("/qmldir")));
|
||||
if (!QQmlImports::isLocal(qmldirUrl)) {
|
||||
// This is a remote file; the import is currently incomplete
|
||||
incomplete = true;
|
||||
}
|
||||
QUrl qmldirUrl = finalUrl().resolved(QUrl(importUri + QLatin1String("/qmldir")));
|
||||
if (!QQmlImports::isLocal(qmldirUrl)) {
|
||||
// This is a remote file; the import is currently incomplete
|
||||
incomplete = true;
|
||||
}
|
||||
|
||||
if (!m_importCache.addFileImport(importDatabase, importUri, importQualifier, import->majorVersion,
|
||||
|
|
|
@ -2601,7 +2601,7 @@ void tst_qqmllanguage::basicRemote_data()
|
|||
|
||||
QTest::newRow("no need for qmldir") << QUrl(serverdir+"Test.qml") << "" << "";
|
||||
QTest::newRow("absent qmldir") << QUrl(serverdir+"/noqmldir/Test.qml") << "" << "";
|
||||
QTest::newRow("need qmldir") << QUrl(serverdir+"TestLocal.qml") << "" << "";
|
||||
QTest::newRow("need qmldir") << QUrl(serverdir+"TestNamed.qml") << "" << "";
|
||||
}
|
||||
|
||||
void tst_qqmllanguage::basicRemote()
|
||||
|
@ -2641,6 +2641,8 @@ void tst_qqmllanguage::importsRemote_data()
|
|||
<< "";
|
||||
QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QQuickImage"
|
||||
<< "";
|
||||
QTest::newRow("remote import with qualifier") << "import \""+serverdir+"\" as NS\nNS.NamedLocal {}" << "QQuickImage"
|
||||
<< "";
|
||||
QTest::newRow("wrong remote import with undeclared local") << "import \""+serverdir+"\"\nWrongTestLocal {}" << ""
|
||||
<< "WrongTestLocal is not a type";
|
||||
QTest::newRow("wrong remote import of internal local") << "import \""+serverdir+"\"\nLocalInternal {}" << ""
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
# For tst_QDeclarativeLoader::networkRequestUrl; no types needed though.
|
Loading…
Reference in New Issue