summaryrefslogtreecommitdiff
path: root/src/location/labs/qmapobjectview.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-12-08 18:45:36 +0100
committerPaolo Angelelli <paolo.angelelli@qt.io>2019-02-01 14:09:48 +0000
commit587b8812c9b2fc7ed7ad4ab35d27114ee98eafc6 (patch)
tree4589a6518d38b504a6941524a959d871cbf2537c /src/location/labs/qmapobjectview.cpp
parent8e923d801b460ccc6fdc92d4a7bc8750410ad042 (diff)
downloadqtlocation-587b8812c9b2fc7ed7ad4ab35d27114ee98eafc6.tar.gz
Introduce QGeoMapObject::geoShape property
In this way MapObjects become a little closer to MapItems, and this property can be used to, for example, center the map on one specific object or object group. Fixes: QTBUG-69640 Change-Id: I4dbead9e670bf5d1eeaccb2bd09d956b8de7da87 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/location/labs/qmapobjectview.cpp')
-rw-r--r--src/location/labs/qmapobjectview.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/location/labs/qmapobjectview.cpp b/src/location/labs/qmapobjectview.cpp
index 27b0ecb8..90234ea6 100644
--- a/src/location/labs/qmapobjectview.cpp
+++ b/src/location/labs/qmapobjectview.cpp
@@ -140,6 +140,25 @@ bool QMapObjectViewPrivateDefault::equals(const QGeoMapObjectPrivate &other) con
&& delegate() == o.delegate());
}
+QGeoShape QMapObjectViewPrivateDefault::geoShape() const
+{
+ const QMapObjectView *qq = static_cast<const QMapObjectView *>(q);
+ QGeoRectangle rect;
+ const QList<QGeoMapObject *> kids = qq->geoMapObjectChildren();
+ for (const auto &kid: kids) {
+ if (!rect.isValid())
+ rect = kid->geoShape().boundingGeoRectangle();
+ else
+ rect = rect.united(kid->geoShape().boundingGeoRectangle());
+ }
+ return rect;
+}
+
+void QMapObjectViewPrivateDefault::setGeoShape(const QGeoShape &/*shape*/)
+{
+ // MOV doesn't support setting the geoshape.
+}
+
/*
QMapObjectView