diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2014-01-22 17:54:24 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-22 13:13:20 -0800 |
commit | 629a1ea0f983b38ead21883d87eabd9cda16c9ad (patch) | |
tree | 3559eb907ab49d56acc4dbe35b9231c3f42016da /qt-ui/profile/profilewidget2.cpp | |
parent | bc7b221498e6f07c26fd8455f9992657f0a1a162 (diff) | |
download | subsurface-629a1ea0f983b38ead21883d87eabd9cda16c9ad.tar.gz |
Simplify the code for the reported ceiling.
The reported ceiling now behaves better by not being deleted / recreated,
instead it uses the same object and connects to the model to know when to
regenerate its plot.
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.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 9fc64a0c1..faeed2065 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -107,6 +107,15 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : scene()->addItem(item); } + reportedCeiling = new DiveReportedCeiling(); + reportedCeiling->setHorizontalAxis(timeAxis); + reportedCeiling->setVerticalAxis(profileYAxis); + reportedCeiling->setModel(dataModel); + reportedCeiling->setVerticalDataColumn(DivePlotDataModel::CEILING); + reportedCeiling->setHorizontalDataColumn(DivePlotDataModel::TIME); + reportedCeiling->setZValue(1); + scene()->addItem(reportedCeiling); + background->setFlag(QGraphicsItem::ItemIgnoresTransformations); //enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID }; @@ -394,18 +403,6 @@ void ProfileWidget2::plotDives(QList<dive*> dives) scene()->addItem(tissueItem); } - if(reportedCeiling){ - scene()->removeItem(reportedCeiling); - delete reportedCeiling; - } - reportedCeiling = new DiveReportedCeiling(); - reportedCeiling->setHorizontalAxis(timeAxis); - reportedCeiling->setVerticalAxis(profileYAxis); - reportedCeiling->setModel(dataModel); - reportedCeiling->setVerticalDataColumn(DivePlotDataModel::CEILING); - reportedCeiling->setHorizontalDataColumn(DivePlotDataModel::TIME); - reportedCeiling->setZValue(1); - scene()->addItem(reportedCeiling); emit startProfileState(); } |