diff options
Diffstat (limited to 'src/location/declarativemaps/qdeclarativepolygonmapitem.cpp')
-rw-r--r-- | src/location/declarativemaps/qdeclarativepolygonmapitem.cpp | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp index 7460a376..8c7afc17 100644 --- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp +++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp @@ -380,20 +380,7 @@ void QDeclarativePolygonMapItem::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *m */ QJSValue QDeclarativePolygonMapItem::path() const { - QQmlContext *context = QQmlEngine::contextForObject(this); - QQmlEngine *engine = context->engine(); - QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine); - - QV4::Scope scope(v4); - QV4::Scoped<QV4::ArrayObject> pathArray(scope, v4->newArrayObject(geopath_.path().length())); - for (int i = 0; i < geopath_.path().length(); ++i) { - const QGeoCoordinate &c = geopath_.coordinateAt(i); - - QV4::ScopedValue cv(scope, v4->fromVariant(QVariant::fromValue(c))); - pathArray->putIndexed(i, cv); - } - - return QJSValue(v4, pathArray.asReturnedValue()); + return fromList(this, geopath_.path()); } void QDeclarativePolygonMapItem::setPath(const QJSValue &value) @@ -401,19 +388,7 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value) if (!value.isArray()) return; - QList<QGeoCoordinate> pathList; - quint32 length = value.property(QStringLiteral("length")).toUInt(); - for (quint32 i = 0; i < length; ++i) { - bool ok; - QGeoCoordinate c = parseCoordinate(value.property(i), &ok); - - if (!ok || !c.isValid()) { - qmlWarning(this) << "Unsupported path type"; - return; - } - - pathList.append(c); - } + QList<QGeoCoordinate> pathList = toList(this, value); // Equivalent to QDeclarativePolylineMapItem::setPathFromGeoList if (geopath_.path() == pathList) |