profile: pass axes and model to DiveEventItem on construction

Firstly, there is no point in supporting DiveEventItems without
model and axis. Secondly, this avoid pointless position-
recalculations.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-06-05 09:15:51 +02:00 committed by Dirk Hohndel
parent c93fb83edf
commit fd2862042b
3 changed files with 14 additions and 29 deletions

View file

@ -725,10 +725,7 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict
// printMode is always selected for SUBSURFACE_MOBILE due to font problems
// BUT events are wanted.
#endif
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix);
item->setHorizontalAxis(timeAxis);
item->setVerticalAxis(profileYAxis, qPrefDisplay::animation_speed());
item->setModel(dataModel);
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix, dataModel, timeAxis, profileYAxis, animSpeed);
item->setZValue(2);
#ifndef SUBSURFACE_MOBILE
item->setScale(printMode ? 4 :1);