diff options
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 35 |
1 files changed, 35 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()){ |