summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativegeoroute_p.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-04 11:58:35 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-15 14:40:23 +0200
commita6c48812eff4e1aa9b05ea4b811de357242c5588 (patch)
treea0524fa87eb6c77b3b0f0d9cb47b88e0655a8e97 /src/location/declarativemaps/qdeclarativegeoroute_p.h
parent366a6379fb80e8c223ae57b2fd791ffdfeacdbf3 (diff)
downloadqtlocation-a6c48812eff4e1aa9b05ea4b811de357242c5588.tar.gz
Change QJSValue properties to QList<QGeoCoordinate/Rectangle>
The QML engine is able to operate on lists of gadgets, there is no need for using private APIs to operate on QJSValue. For the time being, this breaks a QML construct like path[0].longitude = 0 This no longer changes the value of path[0].latitude in place. Instead, use var path0 = path[0] path0.longitude = ... path[0] = path0 This is consistent with other properties that have type list<gadget>, as QML operates on copies of values, not on references. Adapt the test case accordingly. Since support for value-initializing properties of type list<gadget> requires plumbing in the QML engine, and registration of conversion routines from QVariantMap to QGeoCoordinate, augment the test. Remove the now unnecessary toList/fromList conversion functions, and the dependency to private QtQml libraries. Fixes: QTBUG-105241 Change-Id: I8f248c457a6de27a3b2680bdc948c5683ebc7fa0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeoroute_p.h')
-rw-r--r--src/location/declarativemaps/qdeclarativegeoroute_p.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeoroute_p.h b/src/location/declarativemaps/qdeclarativegeoroute_p.h
index 38a0570f..c3e6262f 100644
--- a/src/location/declarativemaps/qdeclarativegeoroute_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoroute_p.h
@@ -56,7 +56,6 @@
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtQml/QQmlPropertyMap>
-#include <QtQml/QJSValue>
#include <QtLocation/QGeoRoute>
#include <QtLocation/QGeoRouteSegment>
@@ -73,7 +72,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRoute : public QObject
Q_PROPERTY(QGeoRectangle bounds READ bounds CONSTANT)
Q_PROPERTY(int travelTime READ travelTime CONSTANT)
Q_PROPERTY(qreal distance READ distance CONSTANT)
- Q_PROPERTY(QJSValue path READ path WRITE setPath NOTIFY pathChanged)
+ Q_PROPERTY(QList<QGeoCoordinate> path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(QList<QGeoRouteSegment> segments READ segments CONSTANT)
Q_PROPERTY(QDeclarativeGeoRouteQuery *routeQuery READ routeQuery REVISION 11)
Q_PROPERTY(QList<QDeclarativeGeoRouteLeg *> legs READ legs CONSTANT REVISION 12)
@@ -88,8 +87,8 @@ public:
int travelTime() const;
qreal distance() const;
- QJSValue path() const;
- void setPath(const QJSValue &value);
+ QList<QGeoCoordinate> path() const;
+ void setPath(const QList<QGeoCoordinate> &value);
QList<QGeoRouteSegment> segments();