mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
bc7b221498
commit
629a1ea0f9
2 changed files with 14 additions and 17 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue