aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-06-22 16:28:40 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-25 07:29:12 +0200
commit0c64967cf3317d4c9863da3c2fe130f93b27eefa (patch)
tree8406b68b344c2a7c691ab4b1990b52a385562d86
parente76ba402bfe309022a0be29c6bc8223f8f3f94b3 (diff)
Correctly resolve qrc:/ URLs in type loading
URLS specified with the qrc scheme do not use the 'authority' part of the syntax, and therefore do not necessarily contain a double slash immediately after the scheme. Task-number: QTBUG-25937 Change-Id: I49156b463f11dbb38d6a01d30ea934b0a652c8e5 Reviewed-by: Martin Jones <martin.jones@nokia.com>
-rw-r--r--src/qml/qml/qqmlfile.cpp22
-rw-r--r--tests/auto/qml/qml.pro1
-rw-r--r--tests/auto/qml/qrcqml/tst_qrcqml.cpp3
3 files changed, 12 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlfile.cpp b/src/qml/qml/qqmlfile.cpp
index b0da80f102..df876b6879 100644
--- a/src/qml/qml/qqmlfile.cpp
+++ b/src/qml/qml/qqmlfile.cpp
@@ -51,7 +51,7 @@
\class QQmlFile
\brief The QQmlFile class gives access to local and remote files.
-Supports file://, qrc://, bundle:// uris and whatever QNetworkAccessManager supports.
+Supports file://, qrc:/, bundle:// uris and whatever QNetworkAccessManager supports.
*/
#define QQMLFILE_MAX_REDIRECT_RECURSION 16
@@ -481,7 +481,7 @@ bool QQmlFile::connectDownloadProgress(QObject *object, int method)
/*!
Returns true if QQmlFile will open \a url synchronously.
-Synchronous urls have a qrc://, file://, or bundle:// scheme.
+Synchronous urls have a qrc:/, file://, or bundle:// scheme.
*/
bool QQmlFile::isSynchronous(const QUrl &url)
{
@@ -498,11 +498,11 @@ bool QQmlFile::isSynchronous(const QUrl &url)
/*!
Returns true if QQmlFile will open \a url synchronously.
-Synchronous urls have a qrc://, file://, or bundle:// scheme.
+Synchronous urls have a qrc:/, file://, or bundle:// scheme.
*/
bool QQmlFile::isSynchronous(const QString &url)
{
- if (url.length() < 6 /* qrc:// */)
+ if (url.length() < 5 /* qrc:/ */)
return false;
QChar f = url[0];
@@ -521,9 +521,9 @@ bool QQmlFile::isSynchronous(const QString &url)
} else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) {
- return url.length() >= 6 /* bundle:// */ &&
+ return url.length() >= 5 /* qrc:/ */ &&
url.startsWith(qrc_string, Qt::CaseInsensitive) &&
- url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/') && url[5] == QLatin1Char('/');
+ url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
}
@@ -556,7 +556,7 @@ bool QQmlFile::isBundle(const QUrl &url)
/*!
Returns true if \a url is a local file that can be opened with QFile.
-Local file urls have either a qrc:// or file:// scheme.
+Local file urls have either a qrc:/ or file:// scheme.
*/
bool QQmlFile::isLocalFile(const QUrl &url)
{
@@ -572,11 +572,11 @@ bool QQmlFile::isLocalFile(const QUrl &url)
/*!
Returns true if \a url is a local file that can be opened with QFile.
-Local file urls have either a qrc:// or file:// scheme.
+Local file urls have either a qrc:/ or file:// scheme.
*/
bool QQmlFile::isLocalFile(const QString &url)
{
- if (url.length() < 6 /* qrc:// */)
+ if (url.length() < 5 /* qrc:/ */)
return false;
QChar f = url[0];
@@ -589,9 +589,9 @@ bool QQmlFile::isLocalFile(const QString &url)
} else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) {
- return url.length() >= 6 /* bundle:// */ &&
+ return url.length() >= 5 /* qrc:/ */ &&
url.startsWith(qrc_string, Qt::CaseInsensitive) &&
- url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/') && url[5] == QLatin1Char('/');
+ url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
}
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
index e41c261b64..48613a4ce5 100644
--- a/tests/auto/qml/qml.pro
+++ b/tests/auto/qml/qml.pro
@@ -46,6 +46,7 @@ PRIVATETESTS += \
qquicklistmodelworkerscript \
qquickworkerscript \
qqmlbundle \
+ qrcqml \
v4
!contains(QT_CONFIG, no-widgets) {
diff --git a/tests/auto/qml/qrcqml/tst_qrcqml.cpp b/tests/auto/qml/qrcqml/tst_qrcqml.cpp
index f5d7dd544c..b81fff0f08 100644
--- a/tests/auto/qml/qrcqml/tst_qrcqml.cpp
+++ b/tests/auto/qml/qrcqml/tst_qrcqml.cpp
@@ -66,9 +66,6 @@ void tst_qrcqml::basicLoad()
{
QQmlEngine e;
QQmlComponent c(&e, QUrl("qrc:/main.qml"));
- if (c.isError())
- qDebug() << "Error: " << c.errors();
- QEXPECT_FAIL("", "QTBUG-25937", Abort);
QVERIFY(c.isReady());
QObject* o = c.create();
QVERIFY(o);