diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-04-29 23:35:36 +0200 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2018-06-27 21:55:01 +0000 |
commit | fafa19f90f3622878519fa9bd331d634a92f1bd9 (patch) | |
tree | cbe929a20a096abd56ae345481a211d7eed78303 /src/positioning | |
parent | 1518ea42bfb08fe5ea8629373c892ad30b453ed4 (diff) | |
download | qtlocation-fafa19f90f3622878519fa9bd331d634a92f1bd9.tar.gz |
QGeoPath: implement clear function
QGeoPath is missing a function to clear its content. This patch
implements it.
[ChangeLog][Positioning] QGeoPath can now be cleared directly using
clearPath.
Task-number: QTBUG-62875
Change-Id: I215edf180d11002c6f7e57bb10b008e935f32340
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/positioning')
-rw-r--r-- | src/positioning/qgeopath.cpp | 18 | ||||
-rw-r--r-- | src/positioning/qgeopath.h | 1 | ||||
-rw-r--r-- | src/positioning/qgeopath_p.h | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/positioning/qgeopath.cpp b/src/positioning/qgeopath.cpp index 94a14ad1..6fc79c07 100644 --- a/src/positioning/qgeopath.cpp +++ b/src/positioning/qgeopath.cpp @@ -197,6 +197,18 @@ const QList<QGeoCoordinate> &QGeoPath::path() const Q_D(const QGeoPath); return d->path(); } + +/*! + Clears the path. + + \since 5.12 +*/ +void QGeoPath::clearPath() +{ + Q_D(QGeoPath); + d->clearPath(); +} + /*! Sets all the elements of the path. @@ -450,6 +462,12 @@ void QGeoPathPrivate::setPath(const QList<QGeoCoordinate> &path) computeBoundingBox(); } +void QGeoPathPrivate::clearPath() +{ + m_path.clear(); + computeBoundingBox(); +} + qreal QGeoPathPrivate::width() const { return m_width; diff --git a/src/positioning/qgeopath.h b/src/positioning/qgeopath.h index 178ac3bf..e4af2add 100644 --- a/src/positioning/qgeopath.h +++ b/src/positioning/qgeopath.h @@ -72,6 +72,7 @@ public: void setPath(const QList<QGeoCoordinate> &path); const QList<QGeoCoordinate> &path() const; + void clearPath(); void setVariantPath(const QVariantList &path); QVariantList variantPath() const; diff --git a/src/positioning/qgeopath_p.h b/src/positioning/qgeopath_p.h index ecba2dcc..6548ce84 100644 --- a/src/positioning/qgeopath_p.h +++ b/src/positioning/qgeopath_p.h @@ -85,6 +85,8 @@ public: const QList<QGeoCoordinate> &path() const; void setPath(const QList<QGeoCoordinate> &path); + void clearPath(); + qreal width() const; void setWidth(const qreal &width); double length(int indexFrom, int indexTo) const; |