1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +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;
_graph = graph;
_sx = 1.0; _sy = 1.0;
_time = _graph.hasTime();
updatePath();
updateBounds();
@ -117,7 +116,7 @@ qreal GraphItem::distanceAtTime(qreal time)
void GraphItem::emitSliderPositionChanged(qreal pos)
{
if (_type == Time) {
if (_time) {
if (_graph.hasTime()) {
if (pos <= _graph.last().t())
emit sliderPositionChanged(distanceAtTime(pos));
else
@ -156,7 +155,7 @@ void GraphItem::updatePath()
{
_path = QPainterPath();
if (_type == Time && !_time)
if (_type == Time && !_graph.hasTime())
return;
_path.moveTo(_graph.first().x(_type) * _sx, -_graph.first().y() * _sy);
@ -166,7 +165,7 @@ void GraphItem::updatePath()
void GraphItem::updateBounds()
{
if (_type == Time && !_time) {
if (_type == Time && !_graph.hasTime()) {
_bounds = QRectF();
return;
}

View File

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