summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-23 15:02:12 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-23 21:11:14 -0800
commit2f0b778f92f9c604535851201090f22e54c20f9a (patch)
treecc9b5db254a805249f3bc33d79ff5701d1f62d90
parent803623042ce4844735e327510521c8a9ed0efa20 (diff)
downloadsubsurface-2f0b778f92f9c604535851201090f22e54c20f9a.tar.gz
Don't recreate the tissues, but instead, reshape them.
This patch makes the Tissues be used as a 'cache', it will not be deleted untill the program closes, but whenever a new dive is selected, the old drawings of the tissues will be regenerated, Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/profilewidget2.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 3451ddf40..3aa1acdae 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -125,6 +125,18 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
diveCeiling->setZValue(1);
scene()->addItem(diveCeiling);
+ for(int i = 0; i < 16; i++){
+ DiveCalculatedTissue *tissueItem = new DiveCalculatedTissue();
+ tissueItem->setHorizontalAxis(timeAxis);
+ tissueItem->setVerticalAxis(profileYAxis);
+ tissueItem->setModel(dataModel);
+ tissueItem->setVerticalDataColumn(DivePlotDataModel::TISSUE_1 + i);
+ tissueItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
+ tissueItem->setZValue(1);
+ allTissues.append(tissueItem);
+ scene()->addItem(tissueItem);
+ }
+
background->setFlag(QGraphicsItem::ItemIgnoresTransformations);
//enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
@@ -384,21 +396,6 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
diveComputerText->setText(currentdc->model);
diveComputerText->animateMoveTo(1 , sceneRect().height());
-
- qDeleteAll(allTissues);
- allTissues.clear();
- for(int i = 0; i < 16; i++){
- DiveCalculatedTissue *tissueItem = new DiveCalculatedTissue();
- tissueItem->setHorizontalAxis(timeAxis);
- tissueItem->setVerticalAxis(profileYAxis);
- tissueItem->setModel(dataModel);
- tissueItem->setVerticalDataColumn(DivePlotDataModel::TISSUE_1 + i);
- tissueItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
- tissueItem->setZValue(1);
- allTissues.append(tissueItem);
- scene()->addItem(tissueItem);
- }
-
emit startProfileState();
}