mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: pass event at construction time to DiveEventItem
There is no point in having a dive event without an event. Let's pass the event at construction time to avoid having to handle "invalid" events. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e42fc1a1e9
commit
c93fb83edf
3 changed files with 9 additions and 20 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue