subsurface/profile-widget/diveeventitem.h
Berthold Stoeger 630862971f Dive pictures: remove close-button optimization
One close-button object was used for all dive pictures. This seems
like a brittle premature optimization and the pixmap is shared
anyway. Make the button a subobject of the dive picture object.

Change the object-hierarchy to be based on QGraphicsItem instead
of QObject. The QObject here is only used as a kludge to support
signals and properties (the latter are necessary for animations).

Remove a comment, which does not seem to be relevant after this
change.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13 13:52:35 -07:00

36 lines
947 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef DIVEEVENTITEM_H
#define DIVEEVENTITEM_H
#include "divepixmapitem.h"
class DiveCartesianAxis;
class DivePlotDataModel;
struct event;
class DiveEventItem : public DivePixmapItem {
Q_OBJECT
public:
DiveEventItem(QGraphicsItem *parent = 0);
virtual ~DiveEventItem();
void setEvent(struct event *ev, struct gasmix *lastgasmix);
struct event *getEvent();
void eventVisibilityChanged(const QString &eventName, bool visible);
void setVerticalAxis(DiveCartesianAxis *axis);
void setHorizontalAxis(DiveCartesianAxis *axis);
void setModel(DivePlotDataModel *model);
bool shouldBeHidden();
public
slots:
void recalculatePos(bool instant = false);
private:
void setupToolTipString(struct gasmix *lastgasmix);
void setupPixmap(struct gasmix *lastgasmix);
DiveCartesianAxis *vAxis;
DiveCartesianAxis *hAxis;
DivePlotDataModel *dataModel;
struct event *internalEvent;
};
#endif // DIVEEVENTITEM_H