summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-04-07 11:36:00 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-08 09:52:23 +0200
commit400c7fa8e767c65aab4b8a1d5161b5259080cec9 (patch)
tree9d5dc04f076a80b1ffe9c18771fde0364877b718
parent19d76d5d7799aa3b98a1e3e0e6e569df14886a54 (diff)
downloadqtlocation-400c7fa8e767c65aab4b8a1d5161b5259080cec9.tar.gz
Ignore invalid center coordinates on maps
This causes undefined behavior and plenty of painter errors due to the occurrence of NaN. At the same time we change the default center to London. Previously it was in the middle of the Atlantic. This led to confusions because the all-blue display was mistaken for nothing/empty/invalid tiles (which is represented by grey). By showing the city of London we ensure that the default shows an easily recognisable area. Change-Id: I65a99d69d961b00a899120e190030e08a5ca0498 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 9e2e4ebb..b627da29 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -187,7 +187,7 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent)
serviceProvider_(0),
mappingManager_(0),
zoomLevel_(8.0),
- center_(0,0),
+ center_(51.5073,-0.1277), //London city center
activeMapType_(0),
componentCompleted_(false),
mappingManagerInitialized_(false),
@@ -656,10 +656,10 @@ qreal QDeclarativeGeoMap::zoomLevel() const
}
/*!
-\qmlproperty coordinate QtLocation::Map::center
+ \qmlproperty coordinate QtLocation::Map::center
This property holds the coordinate which occupies the center of the
- mapping viewport.
+ mapping viewport. Invalid center coordinates are ignored.
The default value is an arbitrary valid coordinate.
*/
@@ -668,6 +668,9 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate &center)
if (!mappingManagerInitialized_ && center == center_)
return;
+ if (!center.isValid())
+ return;
+
center_ = center;
if (center_.isValid() && mappingManagerInitialized_) {