diff options
Diffstat (limited to 'src/imports/location/qdeclarativepolygonmapitem.cpp')
-rw-r--r-- | src/imports/location/qdeclarativepolygonmapitem.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index d2ff46d0..2dd0bfb2 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -406,22 +406,10 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value) QList<QGeoCoordinate> pathList; quint32 length = value.property(QStringLiteral("length")).toUInt(); for (quint32 i = 0; i < length; ++i) { - QJSValue v = value.property(i); - - QGeoCoordinate c; - - if (v.isObject()) { - if (v.hasProperty(QStringLiteral("latitude"))) - c.setLatitude(v.property(QStringLiteral("latitude")).toNumber()); - if (v.hasProperty(QStringLiteral("longitude"))) - c.setLongitude(v.property(QStringLiteral("longitude")).toNumber()); - if (v.hasProperty(QStringLiteral("altitude"))) - c.setAltitude(v.property(QStringLiteral("altitude")).toNumber()); - } else if (v.isString()) { - c = stringToCoordinate(v.toString()).value<QGeoCoordinate>(); - } + bool ok; + QGeoCoordinate c = parseCoordinate(value.property(i), &ok); - if (!c.isValid()) { + if (!ok || !c.isValid()) { qmlInfo(this) << "Unsupported path type"; return; } |