aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-12-02 12:56:51 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-12-02 21:44:16 +0100
commit6cfe4cbebb8e429164f6f1878abb560fa417f9fa (patch)
tree4ec7116946d1d39bcf2c764855416d6054d55b44 /src/qml/jsruntime/qv4engine.cpp
parent9664d9346af854ccc13c099862184d5a0f7544f1 (diff)
Mark url as builtin type
Also, allow conversion from UrlObject and String. We allow the string conversion because we treat string and url as interchangeable in various places. Change-Id: Ib229c6d190e1c5d849ea18798925965b8dbeef7e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index a96e93c212..2892b616b0 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -2240,6 +2240,14 @@ bool ExecutionEngine::metaTypeFromJS(const Value &value, int type, void *data)
*reinterpret_cast<QDate *>(data) = d->toQDateTime().date();
return true;
} break;
+ case QMetaType::QUrl:
+ if (String *s = value.stringValue()) {
+ *reinterpret_cast<QUrl *>(data) = QUrl(s->toQString());
+ return true;
+ } else if (const QV4::UrlObject *d = value.as<UrlObject>()) {
+ *reinterpret_cast<QUrl *>(data) = d->toQUrl();
+ return true;
+ } break;
#if QT_CONFIG(regularexpression)
case QMetaType::QRegularExpression:
if (const QV4::RegExpObject *r = value.as<QV4::RegExpObject>()) {