aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
diff options
context:
space:
mode:
authorNicolas Fella <nicolas.fella@kdab.com>2019-01-29 18:33:21 +0100
committerNicolas Fella <nicolas.fella@kdab.com>2019-02-13 13:47:10 +0000
commit48402d5c4c97bae5762668aaaf9670c644120feb (patch)
tree779ce923d012f64f5b250cef5312a0e1d0733a22 /src/qml/qml/qqmltypeloader.cpp
parent896d49a4e1113e3eb4832b83920b0dfd76987259 (diff)
Support loading images from content:/ URLs on Android
Patch 251038 adds support for content:/ URLs on Android, but to be able to load images from them this patch is needed. It copies the existing code for assets:/ URls Change-Id: Ic086da6396576553a9635dbbbb1fa12d45bd3f52 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r--src/qml/qml/qqmltypeloader.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index fc48957bcb..b508a66f84 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -1821,6 +1821,11 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path)
// assets resource url
QFileInfo fileInfo(QQmlFile::urlToLocalFileOrQrc(path));
return fileInfo.isFile() ? fileInfo.absoluteFilePath() : QString();
+ } else if (path.count() > 8 && path.at(7) == QLatin1Char(':') && path.at(8) == QLatin1Char('/') &&
+ path.startsWith(QLatin1String("content"), Qt::CaseInsensitive)) {
+ // content url
+ QFileInfo fileInfo(QQmlFile::urlToLocalFileOrQrc(path));
+ return fileInfo.isFile() ? fileInfo.absoluteFilePath() : QString();
}
#endif
@@ -1878,6 +1883,11 @@ bool QQmlTypeLoader::fileExists(const QString &path, const QString &file)
// assets resource url
QFileInfo fileInfo(QQmlFile::urlToLocalFileOrQrc(path + file));
return fileInfo.isFile();
+ } else if (path.count() > 8 && path.at(7) == QLatin1Char(':') && path.at(8) == QLatin1Char('/') &&
+ path.startsWith(QLatin1String("content"), Qt::CaseInsensitive)) {
+ // content url
+ QFileInfo fileInfo(QQmlFile::urlToLocalFileOrQrc(path + file));
+ return fileInfo.isFile();
}
#endif
@@ -1913,7 +1923,7 @@ bool QQmlTypeLoader::directoryExists(const QString &path)
bool isResource = path.at(0) == QLatin1Char(':');
#if defined(Q_OS_ANDROID)
- isResource = isResource || path.startsWith(QLatin1String("assets:/"));
+ isResource = isResource || path.startsWith(QLatin1String("assets:/")) || path.startsWith(QLatin1String("content:/"));
#endif
if (isResource) {