1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Back to a correct slider size in PDF output...

This commit is contained in:
Martin Tůma 2016-09-25 18:57:17 +02:00
parent 473b92e8f7
commit 80bf57abfc
2 changed files with 9 additions and 9 deletions

View File

@ -36,20 +36,16 @@ void RouteItem::updateShape()
RouteItem::RouteItem(const Route &route, QGraphicsItem *parent) RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
: PathItem(parent) : PathItem(parent)
{ {
WaypointItem *wi;
QVector<Waypoint> r = route.route(); QVector<Waypoint> r = route.route();
Q_ASSERT(r.count() >= 2); Q_ASSERT(r.count() >= 2);
wi = new WaypointItem(r.at(0), this); new WaypointItem(r.at(0), this);
wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
const QPointF &p = r.at(0).coordinates(); const QPointF &p = r.at(0).coordinates();
_path.moveTo(ll2mercator(QPointF(p.x(), -p.y()))); _path.moveTo(ll2mercator(QPointF(p.x(), -p.y())));
for (int i = 1; i < r.size(); i++) { for (int i = 1; i < r.size(); i++) {
const QPointF &p = r.at(i).coordinates(); const QPointF &p = r.at(i).coordinates();
_path.lineTo(ll2mercator(QPointF(p.x(), -p.y()))); _path.lineTo(ll2mercator(QPointF(p.x(), -p.y())));
wi = new WaypointItem(r.at(i), this); new WaypointItem(r.at(i), this);
wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
} }
_units = Metric; _units = Metric;
@ -66,7 +62,6 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
_marker = new MarkerItem(this); _marker = new MarkerItem(this);
_marker->setPos(_path.pointAtPercent(0)); _marker->setPos(_path.pointAtPercent(0));
_marker->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
} }
void RouteItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, void RouteItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
@ -92,6 +87,10 @@ void RouteItem::setScale(qreal scale)
_pen.setWidthF(ROUTE_WIDTH * 1.0/scale); _pen.setWidthF(ROUTE_WIDTH * 1.0/scale);
QGraphicsItem::setScale(scale); QGraphicsItem::setScale(scale);
QList<QGraphicsItem *> childs = childItems();
for (int i = 0; i < childs.count(); i++)
childs.at(i)->setScale(1.0/scale);
updateShape(); updateShape();
} }
@ -109,6 +108,7 @@ void RouteItem::setUnits(enum Units units)
void RouteItem::moveMarker(qreal distance) void RouteItem::moveMarker(qreal distance)
{ {
qDebug() << distance << _distance;
if (distance > _distance) if (distance > _distance)
_marker->setVisible(false); _marker->setVisible(false);
else { else {

View File

@ -66,7 +66,6 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
_marker = new MarkerItem(this); _marker = new MarkerItem(this);
_marker->setPos(_path.pointAtPercent(0)); _marker->setPos(_path.pointAtPercent(0));
_marker->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
} }
void TrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, void TrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
@ -91,6 +90,7 @@ void TrackItem::setScale(qreal scale)
_pen.setWidthF(TRACK_WIDTH * 1.0/scale); _pen.setWidthF(TRACK_WIDTH * 1.0/scale);
QGraphicsItem::setScale(scale); QGraphicsItem::setScale(scale);
_marker->setScale(1.0/scale);
updateShape(); updateShape();
} }