mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:33:24 +00:00
profile: collect dive-profile items in a vector
Collect all the created profile items in a dynamic vector. This allows us to loop over them when adding them to the scene, instead of addressing each item individually. Hopefully, this will also allow for a more deterministic repaint logic, without relying on signals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
28f156e172
commit
fccbed3ca9
2 changed files with 4 additions and 24 deletions
|
@ -102,6 +102,7 @@ T *ProfileWidget2::createItem(const DiveCartesianAxis &vAxis, int vColumn, int z
|
|||
T *res = new T(*dataModel, *timeAxis, DivePlotDataModel::TIME, vAxis, vColumn,
|
||||
std::forward<Args>(args)...);
|
||||
res->setZValue(static_cast<double>(z));
|
||||
profileItems.push_back(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -237,34 +238,19 @@ void ProfileWidget2::addItemsToScene()
|
|||
scene()->addItem(gasYAxis);
|
||||
scene()->addItem(temperatureAxis);
|
||||
scene()->addItem(timeAxis);
|
||||
scene()->addItem(diveProfileItem);
|
||||
scene()->addItem(cylinderPressureAxis);
|
||||
scene()->addItem(temperatureItem);
|
||||
scene()->addItem(meanDepthItem);
|
||||
scene()->addItem(gasPressureItem);
|
||||
// I cannot seem to figure out if an object that I find with itemAt() on the scene
|
||||
// is the object I am looking for - my guess is there's a simple way in Qt to do that
|
||||
// but nothing I tried worked.
|
||||
// so instead this adds a special magic key/value pair to the object to mark it
|
||||
diveComputerText->setData(SUBSURFACE_OBJ_DATA, SUBSURFACE_OBJ_DC_TEXT);
|
||||
scene()->addItem(diveComputerText);
|
||||
scene()->addItem(reportedCeiling);
|
||||
scene()->addItem(tankItem);
|
||||
scene()->addItem(pn2GasItem);
|
||||
scene()->addItem(pheGasItem);
|
||||
scene()->addItem(po2GasItem);
|
||||
scene()->addItem(o2SetpointGasItem);
|
||||
scene()->addItem(ccrsensor1GasItem);
|
||||
scene()->addItem(ccrsensor2GasItem);
|
||||
scene()->addItem(ccrsensor3GasItem);
|
||||
scene()->addItem(ocpo2GasItem);
|
||||
#ifndef SUBSURFACE_MOBILE
|
||||
scene()->addItem(toolTipItem);
|
||||
scene()->addItem(diveCeiling);
|
||||
scene()->addItem(decoModelParameters);
|
||||
scene()->addItem(percentageAxis);
|
||||
scene()->addItem(heartBeatAxis);
|
||||
scene()->addItem(heartBeatItem);
|
||||
scene()->addItem(rulerItem);
|
||||
scene()->addItem(rulerItem->sourceNode());
|
||||
scene()->addItem(rulerItem->destNode());
|
||||
|
@ -274,16 +260,9 @@ void ProfileWidget2::addItemsToScene()
|
|||
pen.setWidth(0);
|
||||
mouseFollowerHorizontal->setPen(pen);
|
||||
mouseFollowerVertical->setPen(pen);
|
||||
|
||||
Q_FOREACH (DiveCalculatedTissue *tissue, allTissues) {
|
||||
scene()->addItem(tissue);
|
||||
}
|
||||
Q_FOREACH (DivePercentageItem *percentage, allPercentages) {
|
||||
scene()->addItem(percentage);
|
||||
}
|
||||
scene()->addItem(ambPressureItem);
|
||||
scene()->addItem(gflineItem);
|
||||
#endif
|
||||
for (AbstractProfilePolygonItem *item: profileItems)
|
||||
scene()->addItem(item);
|
||||
}
|
||||
|
||||
void ProfileWidget2::setupItemOnScene()
|
||||
|
|
|
@ -193,6 +193,7 @@ private:
|
|||
PartialGasPressureAxis *gasYAxis;
|
||||
TemperatureAxis *temperatureAxis;
|
||||
TimeAxis *timeAxis;
|
||||
std::vector<AbstractProfilePolygonItem *> profileItems;
|
||||
DiveProfileItem *diveProfileItem;
|
||||
DiveTemperatureItem *temperatureItem;
|
||||
DiveMeanDepthItem *meanDepthItem;
|
||||
|
|
Loading…
Add table
Reference in a new issue