mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Move the creation of the Gas Pressure item to the constructor
This makes the Gas Pressure Item a 'cached' item, when the dive changes, the item will regenerate the drawing based on it's model. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2f0b778f92
commit
2c2d3351ac
2 changed files with 10 additions and 14 deletions
|
@ -137,6 +137,15 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
|
|||
scene()->addItem(tissueItem);
|
||||
}
|
||||
|
||||
gasPressureItem = new DiveGasPressureItem();
|
||||
gasPressureItem->setHorizontalAxis(timeAxis);
|
||||
gasPressureItem->setVerticalAxis(cylinderPressureAxis);
|
||||
gasPressureItem->setModel(dataModel);
|
||||
gasPressureItem->setVerticalDataColumn(DivePlotDataModel::TEMPERATURE);
|
||||
gasPressureItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
|
||||
gasPressureItem->setZValue(1);
|
||||
scene()->addItem(gasPressureItem);
|
||||
|
||||
background->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||
|
||||
//enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
|
||||
|
@ -381,19 +390,6 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
|
|||
temperatureItem->setZValue(1);
|
||||
scene()->addItem(temperatureItem);
|
||||
|
||||
if(gasPressureItem){
|
||||
scene()->removeItem(gasPressureItem);
|
||||
delete gasPressureItem;
|
||||
}
|
||||
gasPressureItem = new DiveGasPressureItem();
|
||||
gasPressureItem->setHorizontalAxis(timeAxis);
|
||||
gasPressureItem->setVerticalAxis(cylinderPressureAxis);
|
||||
gasPressureItem->setModel(dataModel);
|
||||
gasPressureItem->setVerticalDataColumn(DivePlotDataModel::TEMPERATURE);
|
||||
gasPressureItem->setHorizontalDataColumn(DivePlotDataModel::TIME);
|
||||
gasPressureItem->setZValue(1);
|
||||
scene()->addItem(gasPressureItem);
|
||||
|
||||
diveComputerText->setText(currentdc->model);
|
||||
diveComputerText->animateMoveTo(1 , sceneRect().height());
|
||||
emit startProfileState();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue