summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-21 16:44:38 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-21 16:44:38 -0300
commit28f48227f72bf7db16b1f53b4d50df7fb5a54131 (patch)
tree5f5995632b27d41bc282704c2b027ce26528e781 /qt-ui/diveplanner.cpp
parent01d1a49d9448a2b4fd6363cf69260cc305b5e9f3 (diff)
downloadsubsurface-28f48227f72bf7db16b1f53b4d50df7fb5a54131.tar.gz
Added a new class to handle the pseudo-buttons on the canvas.
Added a new class, named Button, that has a clicked() signal, and can be connected to the view to emulate buttons. While I know that Qt supports widgets on canvas - I think it's too nineties to have such square controls on something that can have rounded borders. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp18
1 files changed, 18 insertions, 0 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();
+}