From 43cf4fb98417fc6fd2124704fca7f46988d57e72 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 23 Jan 2014 16:03:19 -0200 Subject: Move profile item to be used as cache. the profile item should also use the model to know when to change something, this makes it happen. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'qt-ui/profile/profilewidget2.cpp') diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 2f607590b..2f7505d22 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -155,6 +155,15 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : temperatureItem->setZValue(1); scene()->addItem(temperatureItem); + diveProfileItem = new DiveProfileItem(); + diveProfileItem->setHorizontalAxis(timeAxis); + diveProfileItem->setVerticalAxis(profileYAxis); + diveProfileItem->setModel(dataModel); + diveProfileItem->setVerticalDataColumn(DivePlotDataModel::DEPTH); + diveProfileItem->setHorizontalDataColumn(DivePlotDataModel::TIME); + diveProfileItem->setZValue(0); + scene()->addItem(diveProfileItem); + background->setFlag(QGraphicsItem::ItemIgnoresTransformations); //enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID }; @@ -356,20 +365,6 @@ void ProfileWidget2::plotDives(QList dives) meanDepth->animateMoveTo(3, profileYAxis->posAtValue(pInfo.meandepth)); dataModel->setDive(current_dive, pInfo); - if (diveProfileItem) { - //diveProfileItem->animateDelete(); - scene()->removeItem(diveProfileItem); - delete diveProfileItem; - } - diveProfileItem = new DiveProfileItem(); - diveProfileItem->setHorizontalAxis(timeAxis); - diveProfileItem->setVerticalAxis(profileYAxis); - diveProfileItem->setModel(dataModel); - diveProfileItem->setVerticalDataColumn(DivePlotDataModel::DEPTH); - diveProfileItem->setHorizontalDataColumn(DivePlotDataModel::TIME); - diveProfileItem->setZValue(0); - scene()->addItem(diveProfileItem); - qDeleteAll(eventItems); eventItems.clear(); -- cgit v1.2.3-70-g09d2