return true;
}
-static QUrl urlFromUserString(const QString &data)
-{
- QUrl u;
- // Preserve any valid percent-encoded octets supplied by the source
- u.setEncodedUrl(data.toUtf8(), QUrl::TolerantMode);
- return u;
-}
-
/*!
Generate a store instruction for assigning literal \a v to property \a prop.
{
Instruction::StoreUrl instr;
QString string = v->value.asString();
- QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(urlFromUserString(string));
+ QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string));
instr.propertyIndex = prop->index;
instr.value = output->indexForUrl(u);
output->addInstruction(instr);
} else if (type == qMetaTypeId<QList<QUrl> >()) {
Instruction::StoreUrlQList instr;
QString string = v->value.asString();
- QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(urlFromUserString(string));
+ QUrl u = string.isEmpty() ? QUrl() : output->url.resolved(QUrl(string));
instr.propertyIndex = prop->index;
instr.value = output->indexForUrl(u);
output->addInstruction(instr);
}
}
-static QUrl urlFromUserString(const QByteArray &data)
-{
- QUrl u;
- if (!data.isEmpty())
- {
- // Preserve any valid percent-encoded octets supplied by the source
- u.setEncodedUrl(data, QUrl::TolerantMode);
- }
- return u;
-}
-
-static QUrl urlFromUserString(const QString &data)
-{
- return urlFromUserString(data.toUtf8());
-}
-
// helper function to allow assignment / binding to QList<QUrl> properties.
static QVariant resolvedUrlSequence(const QVariant &value, QQmlContextData *context)
{
if (value.userType() == qMetaTypeId<QUrl>()) {
urls.append(value.toUrl());
} else if (value.userType() == qMetaTypeId<QString>()) {
- urls.append(urlFromUserString(value.toString()));
+ urls.append(QUrl(value.toString()));
} else if (value.userType() == qMetaTypeId<QByteArray>()) {
- urls.append(urlFromUserString(value.toByteArray()));
+ urls.append(QUrl(QString::fromUtf8(value.toByteArray())));
} else if (value.userType() == qMetaTypeId<QList<QUrl> >()) {
urls = value.value<QList<QUrl> >();
} else if (value.userType() == qMetaTypeId<QStringList>()) {
QStringList urlStrings = value.value<QStringList>();
for (int i = 0; i < urlStrings.size(); ++i)
- urls.append(urlFromUserString(urlStrings.at(i)));
+ urls.append(QUrl(urlStrings.at(i)));
} else if (value.userType() == qMetaTypeId<QList<QString> >()) {
QList<QString> urlStrings = value.value<QList<QString> >();
for (int i = 0; i < urlStrings.size(); ++i)
- urls.append(urlFromUserString(urlStrings.at(i)));
+ urls.append(QUrl(urlStrings.at(i)));
} // note: QList<QByteArray> is not currently supported.
QList<QUrl> resolvedUrls;
u = value.toUrl();
found = true;
} else if (variantType == QVariant::ByteArray) {
- u = urlFromUserString(value.toByteArray());
+ u = QUrl(QString::fromUtf8(value.toByteArray()));
found = true;
} else if (variantType == QVariant::String) {
- u = urlFromUserString(value.toString());
+ u = QUrl(value.toString());
found = true;
}