summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-23 15:44:12 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-23 21:11:14 -0800
commit563c39b8221ac2e3730c9f51a0e890b42af8ca78 (patch)
tree031ad3beaa36cf44fe263e05b3a572e1ecaae4ac /qt-ui/profile/profilewidget2.cpp
parent555ca8245d5675bc943a2a0786d4c0168344161c (diff)
downloadsubsurface-563c39b8221ac2e3730c9f51a0e890b42af8ca78.tar.gz
Moved the temperature item as a 'Cache'
This patch moves the temperature item as a cache that will be updated as the model updates, instead of deleting / recreating it everytime the dive changes. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r--qt-ui/profile/profilewidget2.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index e21af21bd..2f607590b 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -146,6 +146,15 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
gasPressureItem->setZValue(1);
scene()->addItem(gasPressureItem);
+ temperatureItem = new DiveTemperatureItem();
+ temperatureItem->setHorizontalAxis(timeAxis);
+ temperatureItem->setVerticalAxis(temperatureAxis);
+ temperatureItem->setModel(dataModel);
+ temperatureItem->setVerticalDataColumn(DivePlotDataModel::TEMPERATURE);
+ temperatureItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
+ temperatureItem->setZValue(1);
+ scene()->addItem(temperatureItem);
+
background->setFlag(QGraphicsItem::ItemIgnoresTransformations);
//enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
@@ -377,19 +386,6 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
event = event->next;
}
- if(temperatureItem){
- scene()->removeItem(temperatureItem);
- delete temperatureItem;
- }
- temperatureItem = new DiveTemperatureItem();
- temperatureItem->setHorizontalAxis(timeAxis);
- temperatureItem->setVerticalAxis(temperatureAxis);
- temperatureItem->setModel(dataModel);
- temperatureItem->setVerticalDataColumn(DivePlotDataModel::TEMPERATURE);
- temperatureItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
- temperatureItem->setZValue(1);
- scene()->addItem(temperatureItem);
-
diveComputerText->setText(currentdc->model);
diveComputerText->animateMoveTo(1 , sceneRect().height());
emit startProfileState();