summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Mattsson <erik.mattsson@appello.com>2013-10-17 15:51:46 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-18 09:55:31 +0200
commit2867f1efc989478667ea7ae56ff91cd991d74121 (patch)
treef3d300a60216bc345270b858c236b83d2bb1a5ff
parentd2411f350e407da0dd299606b8d6f988cf2f9f80 (diff)
downloadqtlocation-2867f1efc989478667ea7ae56ff91cd991d74121.tar.gz
Made fitViewportTo* methods honor qml animations
fitViewportToMapItems and fitViewportToGeoShape ignored any animations that was set on center and zoomLevel in qml. With this change they are now properly animatied if any animation is specified in qml. Change-Id: I8f88875cc9a528566ecdbe5484a413459787b316 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 95812906..b276989e 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -1096,7 +1096,7 @@ void QDeclarativeGeoMap::fitViewportToGeoShape(const QVariant &variantShape)
}
// position camera to the center of bounding box
- setCenter(centerCoordinate);
+ setProperty("center", QVariant::fromValue(centerCoordinate));
//If the shape is empty we just change centerposition, not zoom
if (bboxHeight == 0 && bboxWidth == 0)
@@ -1114,7 +1114,7 @@ void QDeclarativeGeoMap::fitViewportToGeoShape(const QVariant &variantShape)
qreal newZoom = log10(zoomRatio) / log10(0.5);
newZoom = floor(qMax(minimumZoomLevel(), (map_->mapController()->zoom() + newZoom)));
- setZoomLevel(newZoom);
+ setProperty("zoomLevel", QVariant::fromValue(newZoom));
}
/*!
@@ -1211,7 +1211,7 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine)
// position camera to the center of bounding box
QGeoCoordinate coordinate;
coordinate = map_->screenPositionToCoordinate(QPointF(bboxCenterX, bboxCenterY), false);
- setCenter(coordinate);
+ setProperty("center", QVariant::fromValue(coordinate));
// adjust zoom
double bboxWidthRatio = bboxWidth / (bboxWidth + bboxHeight);
@@ -1225,7 +1225,7 @@ void QDeclarativeGeoMap::fitViewportToMapItemsRefine(bool refine)
qreal newZoom = log10(zoomRatio) / log10(0.5);
newZoom = floor(qMax(minimumZoomLevel(), (map_->mapController()->zoom() + newZoom)));
- setZoomLevel(newZoom);
+ setProperty("zoomLevel", QVariant::fromValue(newZoom));
// as map quick items retain the same screen size after the camera zooms in/out
// we refine the viewport again to achieve better results