Enable a context menu to remove dive handlers.

This commit enables a context menu to remove dive handlers,
because it was hard to find that ctrl+click selected it,
then a delete button press removed it. it's better now. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-11-14 23:29:36 -02:00 committed by Dirk Hohndel
parent 3302ee11c1
commit cec30c27d9
2 changed files with 31 additions and 7 deletions

View file

@ -95,11 +95,15 @@ private:
QGraphicsSimpleTextItem *text;
};
class DiveHandler : public QGraphicsEllipseItem{
class DiveHandler : public QObject, public QGraphicsEllipseItem{
Q_OBJECT
public:
DiveHandler();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent* event);
void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
public slots:
void selfRemove();
};
class Ruler : public QGraphicsLineItem{
@ -118,7 +122,6 @@ public:
qreal posAtValue(qreal value);
void setColor(const QColor& color);
void setTextColor(const QColor& color);
private:
Qt::Orientation orientation;
QList<QGraphicsLineItem*> ticks;
@ -210,6 +213,8 @@ private:
int minMinutes; // this holds the minimum duration of the dive.
int dpMaxTime; // this is the time of the dive calculated by the deco.
friend class DiveHandler;
};
#include "ui_diveplanner.h"