summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativerectanglemapitem.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/qdeclarativerectanglemapitem.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/qdeclarativerectanglemapitem.cpp')
-rw-r--r--src/location/declarativemaps/qdeclarativerectanglemapitem.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
index e90c0596..ba67ecad 100644
--- a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
@@ -352,6 +352,24 @@ const QGeoShape &QDeclarativeRectangleMapItem::geoShape() const
return rectangle_;
}
+void QDeclarativeRectangleMapItem::setGeoShape(const QGeoShape &shape)
+{
+ if (shape == rectangle_)
+ return;
+
+ const QGeoRectangle rectangle = rectangle_.boundingGeoRectangle();
+ const bool tlHasChanged = rectangle.topLeft() != rectangle_.topLeft();
+ const bool brHasChanged = rectangle.bottomRight() != rectangle_.bottomRight();
+ rectangle_ = rectangle;
+
+ updatePath();
+ markSourceDirtyAndUpdate();
+ if (tlHasChanged)
+ emit topLeftChanged(rectangle_.topLeft());
+ if (brHasChanged)
+ emit bottomRightChanged(rectangle_.bottomRight());
+}
+
QGeoMap::ItemType QDeclarativeRectangleMapItem::itemType() const
{
return QGeoMap::MapRectangle;