profile: save depth of event

The DivePlotDataModel was saved with every event to access the
depth. However, since the depth never changes, we can simply
save the depth instead.

Also, since we only need the model to access the plot_info,
pass the plot_info directly. As noted in a previous commit
message, I believe that Qt models are a very bad choice
for intra-application data transfer. They should only ever
be used to interface with Qt.

And since touching this code, pass duration_t instead of int
to depthAtTime() to make the callers less cluttered.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-08-31 20:44:37 +02:00 committed by Dirk Hohndel
parent 9ddaf791ae
commit 9740651e01
3 changed files with 16 additions and 18 deletions

View file

@ -500,8 +500,8 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
// printMode is always selected for SUBSURFACE_MOBILE due to font problems
// BUT events are wanted.
#endif
if (DiveEventItem::isInteresting(d, currentdc, event, *dataModel)) {
auto item = new DiveEventItem(d, event, lastgasmix, dataModel,
if (DiveEventItem::isInteresting(d, currentdc, event, plotInfo)) {
auto item = new DiveEventItem(d, event, lastgasmix, plotInfo,
timeAxis, profileYAxis, animSpeed, *pixmaps);
item->setZValue(2);
addItem(item);