From a2865f4cb47d2f571d4ce7eea36a412c28cd6560 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 2 Jun 2017 11:57:51 +0200 Subject: Fix incorrect Map.visibleRegion when all the map is visible Change-Id: I9d532416e0e6dd06f84216d97bcf160e3e8e43be Task-number: QTBUG-57690 Reviewed-by: Alex Blasche --- src/location/declarativemaps/qdeclarativegeomap.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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; } /*! -- cgit v1.2.3