diff options
author | Jürgen Hunold <jhunold@gmx.eu> | 2014-09-23 11:02:04 +0200 |
---|---|---|
committer | Jürgen Hunold <jhunold@gmx.eu> | 2014-09-25 20:50:43 +0200 |
commit | abe565fdce22912b9fc5c4a11d64d739d962cfe3 (patch) | |
tree | f63f5115cc1f74af6aad5e6b36038dc323e988dc /src/imports/location/qdeclarativegeomap.cpp | |
parent | f3edb627dc0cf780a593765babde59e1194aa9eb (diff) | |
download | qtlocation-abe565fdce22912b9fc5c4a11d64d739d962cfe3.tar.gz |
Fix fitViewportToMapItemsRefine when the map solely contains quickitems
Change-Id: I0152af80f1c1165a78310db2b263221036830448
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/imports/location/qdeclarativegeomap.cpp')
-rw-r--r-- | src/imports/location/qdeclarativegeomap.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index a1fbde7d..4fef83e6 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -1065,6 +1065,7 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine) double topLeftY = 0; double bottomRightX = 0; double bottomRightY = 0; + bool haveQuickItem = false; // find bounds of all map items int itemCount = 0; @@ -1079,8 +1080,10 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine) if (refine) { QDeclarativeGeoMapQuickItem *quickItem = qobject_cast<QDeclarativeGeoMapQuickItem*>(item); - if (quickItem) - continue; + if (quickItem) { + haveQuickItem = true; + continue; + } } topLeftX = item->position().x(); @@ -1102,9 +1105,11 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine) ++itemCount; } - if (itemCount == 0) + if (itemCount == 0) { + if (haveQuickItem) + fitViewportToMapItemsRefine(false); return; - + } double bboxWidth = maxX - minX; double bboxHeight = maxY - minY; double bboxCenterX = minX + (bboxWidth / 2.0); |