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 <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-01-16 15:02:32 -02:00 committed by Dirk Hohndel
parent 9cb5ea45d8
commit 1f80788286
5 changed files with 183 additions and 2 deletions

View file

@ -14,6 +14,8 @@
// * It needs to be dynamic, things should *flow* on it, not just appear / disappear.
// */
#include "graphicsview-common.h"
class DiveEventItem;
struct DivePlotDataModel;
struct DivePixmapItem;
struct DiveRectItem;
@ -24,6 +26,7 @@ struct TimeAxis;
struct dive;
struct QStateMachine;
struct DiveCartesianPlane;
struct plot_info;
class ProfileWidget2 : public QGraphicsView {
Q_OBJECT
@ -57,6 +60,10 @@ private:
QStateMachine *stateMachine;
DivePixmapItem *background ;
// All those here should probably be merged into one structure,
// So it's esyer to replicate for more dives later.
// In the meantime, keep it here.
struct plot_info *plotInfo;
DepthAxis *profileYAxis ;
DiveCartesianAxis *gasYAxis;
TimeAxis *timeAxis;
@ -64,6 +71,7 @@ private:
DiveRectItem *timeController;
DiveProfileItem *diveProfileItem;
DiveCartesianPlane *cartesianPlane;
QList<DiveEventItem*> eventItems;
};
#endif