summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/diveplanner.cpp35
-rw-r--r--qt-ui/diveplanner.h2
2 files changed, 37 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 6a721adf0..083ddcfe8 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -135,11 +135,46 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent)
ADD_ACTION(Qt::Key_Escape, keyEscAction());
ADD_ACTION(Qt::Key_Delete, keyDeleteAction());
+ ADD_ACTION(Qt::Key_Up, keyUpAction());
+ ADD_ACTION(Qt::Key_Down, keyDownAction());
#undef ADD_ACTION
setRenderHint(QPainter::Antialiasing);
}
+void DivePlannerGraphics::keyDownAction()
+{
+ if(scene()->selectedItems().count()){
+ Q_FOREACH(QGraphicsItem *i, scene()->selectedItems()){
+ if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler*>(i)){
+ if (handler->mm / 1000 >= depthLine->maximum())
+ continue;
+
+ handler->mm += 1000;
+ double ypos = depthLine->posAtValue(handler->mm / 1000);
+ handler->setPos(handler->pos().x(), ypos);
+ }
+ }
+ createDecoStops();
+ }
+}
+
+void DivePlannerGraphics::keyUpAction()
+{
+ Q_FOREACH(QGraphicsItem *i, scene()->selectedItems()){
+ if (DiveHandler *handler = qgraphicsitem_cast<DiveHandler*>(i)){
+ if (handler->mm / 1000 <= 0)
+ continue;
+
+ handler->mm -= 1000;
+ double ypos = depthLine->posAtValue(handler->mm / 1000);
+ handler->setPos(handler->pos().x(), ypos);
+ }
+ }
+ createDecoStops();
+}
+
+
void DivePlannerGraphics::keyDeleteAction()
{
if(scene()->selectedItems().count()){
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index c6869feb4..5ea9f0dab 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -79,6 +79,8 @@ protected:
private slots:
void keyEscAction();
void keyDeleteAction();
+ void keyUpAction();
+ void keyDownAction();
void increaseTime();
void increaseDepth();
void okClicked();