Do not delete / new object that can be cached.

This way we will always have this object on screen, and as soon as the
model changes, it's contents will change.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-01-22 18:25:35 -02:00 committed by Dirk Hohndel
parent 629a1ea0f9
commit f8a4f8de81
2 changed files with 11 additions and 13 deletions

View file

@ -367,6 +367,8 @@ void DiveCalculatedCeiling::modelDataChanged()
AbstractProfilePolygonItem::modelDataChanged();
// Add 2 points to close the polygon.
QPolygonF poly = polygon();
if (poly.isEmpty())
return;
QPointF p1 = poly.first();
QPointF p2 = poly.last();