mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added 'up' and 'down' actions on the dive planner.
Added 'up' and 'down' keyboard actions on the dive planner, you need to select the handlers with ctrl + click, then press up to make the handler go 1m up, or down, to make the handler go 1m down. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
932ee3da94
commit
52fd769efb
2 changed files with 37 additions and 0 deletions
|
@ -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()){
|
||||
|
|
|
@ -79,6 +79,8 @@ protected:
|
|||
private slots:
|
||||
void keyEscAction();
|
||||
void keyDeleteAction();
|
||||
void keyUpAction();
|
||||
void keyDownAction();
|
||||
void increaseTime();
|
||||
void increaseDepth();
|
||||
void okClicked();
|
||||
|
|
Loading…
Add table
Reference in a new issue