summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-08-10 12:50:10 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-08-14 11:16:53 +0000
commit40e9867254d2241fdac1ea76d416ad54e71d04ac (patch)
tree1e377b8ab2eabc87490e300c34983c5c0dc6461c /src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
parent07be65e9d9a883aab4e1fda367cf591b7cb97631 (diff)
downloadqtlocation-40e9867254d2241fdac1ea76d416ad54e71d04ac.tar.gz
Make QDeclarativeGeoMapItemBase::geoShape R/W
This patch adds a setter for the geoShape property, overridden in the subclasses. Change-Id: I5fc4d412efee5e95c5650943ea5bf9b72dc40155 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativepolylinemapitem.cpp')
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
index e6619800..70b4bc21 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
@@ -998,6 +998,22 @@ const QGeoShape &QDeclarativePolylineMapItem::geoShape() const
return geopath_;
}
+void QDeclarativePolylineMapItem::setGeoShape(const QGeoShape &shape)
+{
+ if (shape == geopath_)
+ return;
+
+ const QGeoPath geopath(shape); // if shape isn't a path, path will be created as a default-constructed path
+ const bool pathHasChanged = geopath.path() != geopath_.path();
+ geopath_ = geopath;
+
+ regenerateCache();
+ geometry_.setPreserveGeometry(true, geopath_.boundingGeoRectangle().topLeft());
+ markSourceDirtyAndUpdate();
+ if (pathHasChanged)
+ emit pathChanged();
+}
+
QGeoMap::ItemType QDeclarativePolylineMapItem::itemType() const
{
return QGeoMap::MapPolyline;