Prevent memory leak by removing the texts on the TemperatureItem

This patch prevents memory leak by adding the text on the list of
'delete me when model changes' items. it also makes things a bit more
snappy because the scene doesn't have to deal with all of the
texts bounding rectangles eveytime.

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-23 16:07:22 -02:00 committed by Dirk Hohndel
parent 43cf4fb984
commit 0f5069784d

View file

@ -249,6 +249,7 @@ void DiveTemperatureItem::createTextItem(int sec, int mkelvin)
text->setPos(QPointF(hAxis->posAtValue(sec), vAxis->posAtValue(mkelvin)));
text->setText(QString("%1%2").arg(deg, 0, 'f', 1).arg(unit));
// text->setSize(TEMP_TEXT_SIZE); //TODO: TEXT SIZE!
texts.append(text);
}
void DiveTemperatureItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)