diff options
Diffstat (limited to 'profile-widget/diveeventitem.cpp')
-rw-r--r-- | profile-widget/diveeventitem.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 9cb28e168..3590a35c8 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -14,14 +14,18 @@ #define DEPTH_NOT_FOUND (-2342) -DiveEventItem::DiveEventItem(QGraphicsItem *parent) : DivePixmapItem(parent), +DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix, QGraphicsItem *parent) : DivePixmapItem(parent), vAxis(NULL), hAxis(NULL), dataModel(NULL), - internalEvent(NULL), - dive(NULL) + internalEvent(clone_event(ev)), + dive(d) { setFlag(ItemIgnoresTransformations); + + setupPixmap(lastgasmix); + setupToolTipString(lastgasmix); + recalculatePos(0); } DiveEventItem::~DiveEventItem() @@ -54,19 +58,6 @@ struct event *DiveEventItem::getEvent() return internalEvent; } -void DiveEventItem::setEvent(const struct dive *d, struct event *ev, struct gasmix lastgasmix) -{ - if (!ev) - return; - - dive = d; - free(internalEvent); - internalEvent = clone_event(ev); - setupPixmap(lastgasmix); - setupToolTipString(lastgasmix); - recalculatePos(0); -} - void DiveEventItem::setupPixmap(struct gasmix lastgasmix) { const IconMetrics& metrics = defaultIconMetrics(); |