From 1f8078828663f6bfff768cbc2fb36e6643eb3d0e Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 16 Jan 2014 15:02:32 -0200 Subject: Added a DiveEventItem that knows how to handle itself. Simply pass a event to the item and it will know what to do. The sad part is that this isn't true yet - there's quite a bit of boilerplate that a lot of the items are needing, but the good part is that the boolerplate is the same in all of the items, which means that I can create a tiny bit of abstraction to encapsulate it and the code will be way smaller to setup the items on the canvas. Right now the items are being correctly placed on the right places. It doesn't supports hidding / showing yet. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveeventitem.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 qt-ui/profile/diveeventitem.h (limited to 'qt-ui/profile/diveeventitem.h') diff --git a/qt-ui/profile/diveeventitem.h b/qt-ui/profile/diveeventitem.h new file mode 100644 index 000000000..896036e8d --- /dev/null +++ b/qt-ui/profile/diveeventitem.h @@ -0,0 +1,29 @@ +#ifndef DIVEEVENTITEM_H +#define DIVEEVENTITEM_H + +#include "divepixmapitem.h" + +class DiveCartesianAxis; +class DivePlotDataModel; +struct event; + +class DiveEventItem : public DivePixmapItem { + Q_OBJECT +public: + DiveEventItem(QObject* parent = 0); + void setEvent(struct event *ev); + void eventVisibilityChanged(const QString& eventName, bool visible); + void setVerticalAxis(DiveCartesianAxis *axis); + void setHorizontalAxis(DiveCartesianAxis *axis); + void setModel(DivePlotDataModel *model); + void recalculate(); +private: + void setupToolTipString(); + void setupPixmap(); + DiveCartesianAxis *vAxis; + DiveCartesianAxis *hAxis; + DivePlotDataModel *dataModel; + struct event* internalEvent; +}; + +#endif \ No newline at end of file -- cgit v1.2.3-70-g09d2