summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-06-02 11:57:51 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-06-09 09:24:20 +0000
commita2865f4cb47d2f571d4ce7eea36a412c28cd6560 (patch)
tree9854a1e7a676afc9c9d42fcbc774228a539ab6af
parenta4dc11fd52f42676265cff2ff9396a7396f1ccb3 (diff)
downloadqtlocation-a2865f4cb47d2f571d4ce7eea36a412c28cd6560.tar.gz
Fix incorrect Map.visibleRegion when all the map is visible
Change-Id: I9d532416e0e6dd06f84216d97bcf160e3e8e43be Task-number: QTBUG-57690 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 9f4dae3f..572745fd 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -1324,7 +1324,17 @@ QGeoShape QDeclarativeGeoMap::visibleRegion() const
for (const QDoubleVector2D &c: visibleRegion)
path.addCoordinate(m_map->geoProjection().wrappedMapProjectionToGeo(c));
- return path.boundingGeoRectangle();
+ QGeoRectangle vr = path.boundingGeoRectangle();
+
+ bool empty = vr.topLeft().latitude() == vr.bottomRight().latitude() ||
+ qFuzzyCompare(vr.topLeft().longitude(), vr.bottomRight().longitude()); // QTBUG-57690
+
+ if (empty) {
+ vr.setTopLeft(QGeoCoordinate(vr.topLeft().latitude(), -180));
+ vr.setBottomRight(QGeoCoordinate(vr.bottomRight().latitude(), 180));
+ }
+
+ return vr;
}
/*!