diff options
-rw-r--r-- | qt-ui/diveplanner.cpp | 18 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 16 |
2 files changed, 33 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 5d907a627..026e9f312 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -43,6 +43,14 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) depthString = new QGraphicsSimpleTextItem(); depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations); scene()->addItem(depthString); + + plusDepth = new Button(); + plusDepth->setPos(15, 1); + scene()->addItem(plusDepth); + + plusTime = new Button(); + plusTime->setPos( 95, 90); + scene()->addItem(plusTime); } void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event) @@ -352,3 +360,13 @@ double Ruler::minimum() const return min; } +Button::Button(QObject* parent): QObject(parent), QGraphicsPixmapItem() +{ + setPixmap(QPixmap(":plus").scaled(20,20)); + setFlag(ItemIgnoresTransformations); +} + +void Button::mousePressEvent(QGraphicsSceneMouseEvent* event) +{ + emit clicked(); +} diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index 621e8a2a5..c3ae3eb60 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -5,6 +5,16 @@ #include <QGraphicsPathItem> #include <QDialog> +class Button : public QObject, public QGraphicsPixmapItem { + Q_OBJECT +public: + explicit Button(QObject* parent = 0); +protected: + virtual void mousePressEvent(QGraphicsSceneMouseEvent* event); +signals: + void clicked(); +}; + class DiveHandler : public QGraphicsEllipseItem{ public: DiveHandler(); @@ -52,7 +62,6 @@ protected: void clear_generated_deco(); void create_deco_stop(); bool isPointOutOfBoundaries(const QPointF& point); - private: void moveActiveHandler(const QPointF& pos); @@ -68,6 +77,11 @@ private: Ruler *depthLine; QGraphicsSimpleTextItem *depthString; + Button *plusTime; + Button *plusDepth; + Button *lessTime; + Button *lessDepth; + }; namespace Ui{ |