1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-12-01 07:01:16 +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 qreal GraphItem::max() const

View File

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