summaryrefslogtreecommitdiffstats
path: root/profile-widget/profilewidget2.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-24 09:13:56 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-04-02 13:53:23 -0700
commit396758d4896197be9dd9f6d71e094068203e52a6 (patch)
tree5f87c0f5dd2c7362be06d1626ffdfe8601a02481 /profile-widget/profilewidget2.h
parent1b14a211f0719aa3a46bf0584d5652bc7c7a4b6f (diff)
downloadsubsurface-396758d4896197be9dd9f6d71e094068203e52a6.tar.gz
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>
Diffstat (limited to 'profile-widget/profilewidget2.h')
-rw-r--r--profile-widget/profilewidget2.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index b2632d511..395832d40 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -227,7 +227,7 @@ private:
#endif
TankItem *tankItem;
- QList<QGraphicsSimpleTextItem *> gases;
+ std::vector<std::unique_ptr<QGraphicsSimpleTextItem>> gases;
//specifics for ADD and PLAN
#ifndef SUBSURFACE_MOBILE
@@ -251,7 +251,8 @@ private:
void updateThumbnailPaintOrder();
#endif
- QList<DiveHandler *> handles;
+ std::vector<std::unique_ptr<DiveHandler>> handles;
+ int handleIndex(const DiveHandler *h) const;
#ifndef SUBSURFACE_MOBILE
void repositionDiveHandlers();
int fixHandlerIndex(DiveHandler *activeHandler);