Merge PR #206: Fix a crash when a graphview is updated with the very first value
This commit is contained in:
commit
2bec98ab7c
@ -396,9 +396,11 @@ void LogsModelNg::newLogEntryReceived(const QVariantMap &data)
|
|||||||
m_graphSeries->removePoints(0, 2);
|
m_graphSeries->removePoints(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent triangles, add a point right before the new one which reflects the old value
|
// Prevent triangles, add a point right before the new one which reflects the old value (if there is one)
|
||||||
qreal previousValue = m_graphSeries->points().at(0).y();
|
if (m_graphSeries->points().count() > 0) {
|
||||||
m_graphSeries->insert(0, QPointF(entry->timestamp().addMSecs(-1).toMSecsSinceEpoch(), previousValue));
|
qreal previousValue = m_graphSeries->points().at(0).y();
|
||||||
|
m_graphSeries->insert(0, QPointF(entry->timestamp().addMSecs(-1).toMSecsSinceEpoch(), previousValue));
|
||||||
|
}
|
||||||
|
|
||||||
// Add the actual value
|
// Add the actual value
|
||||||
m_graphSeries->insert(0, QPointF(entry->timestamp().toMSecsSinceEpoch(), entry->value().toBool() ? 1 : 0));
|
m_graphSeries->insert(0, QPointF(entry->timestamp().toMSecsSinceEpoch(), entry->value().toBool() ? 1 : 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user