profile use unique_ptr to manage dive handler objects

Instead of manually deleting them (and the gases). Currently
there is only one point where these are deleted, but if
we implement proper Qt model/view semantics, this makes things
less headachy.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-24 09:13:56 +01:00 committed by Dirk Hohndel
parent 1b14a211f0
commit 396758d489
3 changed files with 31 additions and 26 deletions

View file

@ -22,7 +22,7 @@ DiveHandler::DiveHandler(const struct dive *d) : dive(d)
int DiveHandler::parentIndex()
{
ProfileWidget2 *view = qobject_cast<ProfileWidget2 *>(scene()->views().first());
return view->handles.indexOf(this);
return view->handleIndex(this);
}
void DiveHandler::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)