From 80bf57abfce08ba59cae7f84e93c95f8324258b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 25 Sep 2016 18:57:17 +0200 Subject: [PATCH] Back to a correct slider size in PDF output... --- src/routeitem.cpp | 16 ++++++++-------- src/trackitem.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/routeitem.cpp b/src/routeitem.cpp index 66e6f0da..448ed0fd 100644 --- a/src/routeitem.cpp +++ b/src/routeitem.cpp @@ -36,20 +36,16 @@ void RouteItem::updateShape() RouteItem::RouteItem(const Route &route, QGraphicsItem *parent) : PathItem(parent) { - WaypointItem *wi; - QVector r = route.route(); Q_ASSERT(r.count() >= 2); - wi = new WaypointItem(r.at(0), this); - wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true); + new WaypointItem(r.at(0), this); const QPointF &p = r.at(0).coordinates(); _path.moveTo(ll2mercator(QPointF(p.x(), -p.y()))); for (int i = 1; i < r.size(); i++) { const QPointF &p = r.at(i).coordinates(); _path.lineTo(ll2mercator(QPointF(p.x(), -p.y()))); - wi = new WaypointItem(r.at(i), this); - wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true); + new WaypointItem(r.at(i), this); } _units = Metric; @@ -66,7 +62,6 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent) _marker = new MarkerItem(this); _marker->setPos(_path.pointAtPercent(0)); - _marker->setFlag(QGraphicsItem::ItemIgnoresTransformations, true); } void RouteItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, @@ -92,6 +87,10 @@ void RouteItem::setScale(qreal scale) _pen.setWidthF(ROUTE_WIDTH * 1.0/scale); QGraphicsItem::setScale(scale); + QList childs = childItems(); + for (int i = 0; i < childs.count(); i++) + childs.at(i)->setScale(1.0/scale); + updateShape(); } @@ -109,7 +108,8 @@ void RouteItem::setUnits(enum Units units) void RouteItem::moveMarker(qreal distance) { - if (distance > _distance) +qDebug() << distance << _distance; + if (distance > _distance) _marker->setVisible(false); else { _marker->setVisible(true); diff --git a/src/trackitem.cpp b/src/trackitem.cpp index 06b1bb2e..9d095d17 100644 --- a/src/trackitem.cpp +++ b/src/trackitem.cpp @@ -66,7 +66,6 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent) _marker = new MarkerItem(this); _marker->setPos(_path.pointAtPercent(0)); - _marker->setFlag(QGraphicsItem::ItemIgnoresTransformations, true); } void TrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, @@ -91,6 +90,7 @@ void TrackItem::setScale(qreal scale) _pen.setWidthF(TRACK_WIDTH * 1.0/scale); QGraphicsItem::setScale(scale); + _marker->setScale(1.0/scale); updateShape(); }