summaryrefslogtreecommitdiff
path: root/src/positioning/qgeopath.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-05-30 15:28:14 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-06-07 11:12:51 +0000
commite8dedcd7c621715813b7b954bb7f64c88aa6523d (patch)
tree087f958ceaa0cb920eb889389afa291454ca09ab /src/positioning/qgeopath.cpp
parentf55629245259ba7364e258f92408823024423caa (diff)
downloadqtlocation-e8dedcd7c621715813b7b954bb7f64c88aa6523d.tar.gz
Add QGeoPath::size
A way to retrieve the size of the path is missing, as the path property turns out not to be accessible to QML. This patch adds a Q_INVOKABLE method to expose it. [ChangeLog][QtPositioning][QGeoPath] Add ::size() to QGeoPath to retrieve the number of coordinates in the path. Change-Id: Ifa7a640113cba71f23e36626a84c8b2fe473a07e Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/positioning/qgeopath.cpp')
-rw-r--r--src/positioning/qgeopath.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/positioning/qgeopath.cpp b/src/positioning/qgeopath.cpp
index ad3536af..858dc0bd 100644
--- a/src/positioning/qgeopath.cpp
+++ b/src/positioning/qgeopath.cpp
@@ -247,6 +247,17 @@ double QGeoPath::length(int indexFrom, int indexTo) const
}
/*!
+ Returns the number of elements in the path.
+
+ \since 5.10
+*/
+int QGeoPath::size() const
+{
+ Q_D(const QGeoPath);
+ return d->size();
+}
+
+/*!
Appends \a coordinate to the path.
*/
void QGeoPath::addCoordinate(const QGeoCoordinate &coordinate)
@@ -415,6 +426,11 @@ double QGeoPathPrivate::length(int indexFrom, int indexTo) const
return len;
}
+int QGeoPathPrivate::size() const
+{
+ return m_path.size();
+}
+
/*!
Returns true if coordinate is present in m_path.
*/