1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2016-11-05 17:37:04 +01:00
parent b9098c0dc5
commit 585ded6b1c
2 changed files with 3 additions and 5 deletions

View File

@ -15,7 +15,6 @@ GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
_type = Distance; _type = Distance;
_graph = graph; _graph = graph;
_sx = 1.0; _sy = 1.0; _sx = 1.0; _sy = 1.0;
_time = _graph.hasTime();
updatePath(); updatePath();
updateBounds(); updateBounds();
@ -117,7 +116,7 @@ qreal GraphItem::distanceAtTime(qreal time)
void GraphItem::emitSliderPositionChanged(qreal pos) void GraphItem::emitSliderPositionChanged(qreal pos)
{ {
if (_type == Time) { if (_type == Time) {
if (_time) { if (_graph.hasTime()) {
if (pos <= _graph.last().t()) if (pos <= _graph.last().t())
emit sliderPositionChanged(distanceAtTime(pos)); emit sliderPositionChanged(distanceAtTime(pos));
else else
@ -156,7 +155,7 @@ void GraphItem::updatePath()
{ {
_path = QPainterPath(); _path = QPainterPath();
if (_type == Time && !_time) if (_type == Time && !_graph.hasTime())
return; return;
_path.moveTo(_graph.first().x(_type) * _sx, -_graph.first().y() * _sy); _path.moveTo(_graph.first().x(_type) * _sx, -_graph.first().y() * _sy);
@ -166,7 +165,7 @@ void GraphItem::updatePath()
void GraphItem::updateBounds() void GraphItem::updateBounds()
{ {
if (_type == Time && !_time) { if (_type == Time && !_graph.hasTime()) {
_bounds = QRectF(); _bounds = QRectF();
return; return;
} }

View File

@ -44,7 +44,6 @@ private:
Graph _graph; Graph _graph;
GraphType _type; GraphType _type;
bool _time;
QPainterPath _path; QPainterPath _path;
QRectF _bounds; QRectF _bounds;