1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 03:42:09 +01:00

Fixed route marker display issues.

Code cleanup.
This commit is contained in:
Martin Tůma 2016-09-25 18:44:33 +02:00
parent 1634b0715c
commit 473b92e8f7
3 changed files with 7 additions and 10 deletions

View File

@ -83,7 +83,7 @@ void AxisItem::updateBoundingRect()
if (_type == X) {
_boundingRect = QRectF(-ss.width()/2, -TICK/2,
_size + es.width()/2 + ss.width()/2,
ls.height() + es.height() - fm.descent() + TICK + 2*PADDING);
ls.height() + es.height() - fm.descent() + TICK + 2*PADDING + 1);
} else {
int mtw = 0;
QRect ts;

View File

@ -41,15 +41,15 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
QVector<Waypoint> r = route.route();
Q_ASSERT(r.count() >= 2);
wi = new WaypointItem(r.at(0));
wi->setParentItem(this);
wi = new WaypointItem(r.at(0), this);
wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
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));
wi->setParentItem(this);
wi = new WaypointItem(r.at(i), this);
wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
}
_units = Metric;
@ -66,6 +66,7 @@ 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,
@ -91,10 +92,6 @@ void RouteItem::setScale(qreal scale)
_pen.setWidthF(ROUTE_WIDTH * 1.0/scale);
QGraphicsItem::setScale(scale);
QList<QGraphicsItem *> childs = childItems();
for (int i = 0; i < childs.count(); i++)
childs.at(i)->setScale(1.0/scale);
updateShape();
}

View File

@ -66,6 +66,7 @@ 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,
@ -90,7 +91,6 @@ void TrackItem::setScale(qreal scale)
_pen.setWidthF(TRACK_WIDTH * 1.0/scale);
QGraphicsItem::setScale(scale);
_marker->setScale(1.0/scale);
updateShape();
}