Consider "assets" scheme as a local file on Android
Task-number: QTBUG-46010 Change-Id: Icb6c5c2529b77e3967f6d23217e63e7773a5d706 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
6e18f57a9c
commit
c8db55970f
@ -225,9 +225,13 @@ QString QFileSelector::select(const QString &filePath) const
|
|||||||
return d->select(filePath);
|
return d->select(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString qrcScheme()
|
static bool isLocalScheme(const QString &file)
|
||||||
{
|
{
|
||||||
return QStringLiteral("qrc");
|
bool local = file == QStringLiteral("qrc");
|
||||||
|
#ifdef Q_OS_ANDROID
|
||||||
|
local |= file == QStringLiteral("assets");
|
||||||
|
#endif
|
||||||
|
return local;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -240,10 +244,10 @@ static QString qrcScheme()
|
|||||||
QUrl QFileSelector::select(const QUrl &filePath) const
|
QUrl QFileSelector::select(const QUrl &filePath) const
|
||||||
{
|
{
|
||||||
Q_D(const QFileSelector);
|
Q_D(const QFileSelector);
|
||||||
if (filePath.scheme() != qrcScheme() && !filePath.isLocalFile())
|
if (!isLocalScheme(filePath.scheme()) && !filePath.isLocalFile())
|
||||||
return filePath;
|
return filePath;
|
||||||
QUrl ret(filePath);
|
QUrl ret(filePath);
|
||||||
if (filePath.scheme() == qrcScheme()) {
|
if (isLocalScheme(filePath.scheme())) {
|
||||||
QString equivalentPath = QLatin1Char(':') + filePath.path();
|
QString equivalentPath = QLatin1Char(':') + filePath.path();
|
||||||
QString selectedPath = d->select(equivalentPath);
|
QString selectedPath = d->select(equivalentPath);
|
||||||
ret.setPath(selectedPath.remove(0, 1));
|
ret.setPath(selectedPath.remove(0, 1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user