diff --git a/src/axisitem.cpp b/src/axisitem.cpp index 736eb72e..9fd74e9d 100644 --- a/src/axisitem.cpp +++ b/src/axisitem.cpp @@ -34,6 +34,8 @@ AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent) { _type = type; _size = 0; + + setCacheMode(QGraphicsItem::DeviceCoordinateCache); } void AxisItem::setRange(const RangeF &range) diff --git a/src/routeitem.cpp b/src/routeitem.cpp index fbadb618..caff3c34 100644 --- a/src/routeitem.cpp +++ b/src/routeitem.cpp @@ -53,6 +53,7 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent) setToolTip(toolTip()); setCursor(Qt::ArrowCursor); setAcceptHoverEvents(true); + setCacheMode(QGraphicsItem::DeviceCoordinateCache); updateShape(); diff --git a/src/scaleitem.cpp b/src/scaleitem.cpp index e4da2930..d2a786b4 100644 --- a/src/scaleitem.cpp +++ b/src/scaleitem.cpp @@ -17,6 +17,8 @@ ScaleItem::ScaleItem(QGraphicsItem *parent) : QGraphicsItem(parent) _units = Metric; _zoom = ZOOM_MIN; _lat = 0; + + setCacheMode(QGraphicsItem::DeviceCoordinateCache); } void ScaleItem::updateBoundingRect() @@ -112,9 +114,10 @@ void ScaleItem::computeScale() } } -void ScaleItem::setLatitude(qreal lat) +void ScaleItem::setZoom(int z, qreal lat) { prepareGeometryChange(); + _zoom = z; _lat = lat; computeScale(); updateBoundingRect(); diff --git a/src/scaleitem.h b/src/scaleitem.h index 895490a5..29ab7e80 100644 --- a/src/scaleitem.h +++ b/src/scaleitem.h @@ -13,8 +13,8 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - void setLatitude(qreal lat); void setZoom(int z); + void setZoom(int z, qreal lat); void setUnits(enum Units units); private: diff --git a/src/trackitem.cpp b/src/trackitem.cpp index 98fc1fda..136cf0dc 100644 --- a/src/trackitem.cpp +++ b/src/trackitem.cpp @@ -53,6 +53,7 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent) setToolTip(toolTip()); setCursor(Qt::ArrowCursor); setAcceptHoverEvents(true); + setCacheMode(QGraphicsItem::DeviceCoordinateCache); updateShape(); diff --git a/src/trackview.cpp b/src/trackview.cpp index ec68d3bc..95fcbba6 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -136,8 +136,7 @@ void TrackView::loadGPX(const GPX &gpx) _scene->setSceneRect(ba); centerOn(ba.center()); - _mapScale->setLatitude(-(br.center().ry() * _scale)); - _mapScale->setZoom(_zoom); + _mapScale->setZoom(_zoom, -(br.center().ry() * _scale)); if (_mapScale->scene() != _scene) _scene->addItem(_mapScale); }