diff options
Diffstat (limited to 'profile-widget/diveeventitem.cpp')
-rw-r--r-- | profile-widget/diveeventitem.cpp | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 3590a35c8..1a0694979 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -14,10 +14,12 @@ #define DEPTH_NOT_FOUND (-2342) -DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix, QGraphicsItem *parent) : DivePixmapItem(parent), - vAxis(NULL), - hAxis(NULL), - dataModel(NULL), +DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix, + DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, + int speed, QGraphicsItem *parent) : DivePixmapItem(parent), + vAxis(vAxis), + hAxis(hAxis), + dataModel(model), internalEvent(clone_event(ev)), dive(d) { @@ -26,31 +28,15 @@ DiveEventItem::DiveEventItem(const struct dive *d, struct event *ev, struct gasm setupPixmap(lastgasmix); setupToolTipString(lastgasmix); recalculatePos(0); -} -DiveEventItem::~DiveEventItem() -{ - free(internalEvent); -} - -void DiveEventItem::setHorizontalAxis(DiveCartesianAxis *axis) -{ - hAxis = axis; - recalculatePos(0); -} -void DiveEventItem::setModel(DivePlotDataModel *model) -{ - dataModel = model; - recalculatePos(0); + connect(vAxis, &DiveCartesianAxis::sizeChanged, this, + [speed, this] { recalculatePos(speed); }); } -void DiveEventItem::setVerticalAxis(DiveCartesianAxis *axis, int speed) +DiveEventItem::~DiveEventItem() { - vAxis = axis; - recalculatePos(0); - connect(vAxis, &DiveCartesianAxis::sizeChanged, this, - [speed, this] { recalculatePos(speed); }); + free(internalEvent); } struct event *DiveEventItem::getEvent() |