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

Fixed broken graphs with missing time data handling

This commit is contained in:
Martin Tůma 2019-10-27 19:53:32 +01:00
parent e6b205e823
commit a1de3c956c
2 changed files with 8 additions and 2 deletions

View File

@ -234,7 +234,8 @@ void GraphItem::updateBounds()
}
}
_bounds = QRectF(QPointF(left, top), QPointF(right, bottom));
QRectF bounds(QPointF(left, top), QPointF(right, bottom));
_bounds = bounds.isValid() ? bounds : QRectF();
}
qreal GraphItem::max() const

View File

@ -166,6 +166,10 @@ void GraphView::setGraphType(GraphType type)
for (int i = 0; i < _graphs.count(); i++) {
GraphItem *gi = _graphs.at(i);
gi->setGraphType(type);
if (gi->bounds().isNull())
removeItem(gi);
else
addItem(gi);
_bounds |= gi->bounds();
}
@ -194,7 +198,8 @@ void GraphView::addGraph(GraphItem *graph)
SLOT(emitSliderPositionChanged(qreal)));
_graphs.append(graph);
_scene->addItem(graph);
if (!graph->bounds().isNull())
_scene->addItem(graph);
_bounds |= graph->bounds();
setXUnits();