From 2f0b778f92f9c604535851201090f22e54c20f9a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 23 Jan 2014 15:02:12 -0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'qt-ui/profile') 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 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(); } -- cgit v1.2.3-70-g09d2