Context menu entry to change setpoint

This patch adds a context menu entry to add a setpoint change
event. In particular, this can be used to turn a logged dive into
a CCR dive.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-11-26 14:22:41 +01:00 committed by Dirk Hohndel
parent 96a94f1a19
commit fb265c2929
4 changed files with 51 additions and 1 deletions

View file

@ -1128,6 +1128,8 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
gasChange->addAction(action);
}
}
QAction *setpointAction = m.addAction(tr("Add set-point change"), this, SLOT(addSetpointChange()));
setpointAction->setData(event->globalPos());
QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark()));
action->setData(event->globalPos());
if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
@ -1282,6 +1284,14 @@ void ProfileWidget2::addBookmark()
replot();
}
void ProfileWidget2::addSetpointChange()
{
QAction *action = qobject_cast<QAction *>(sender());
QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint()));
SetpointDialog::instance()->setpointData(current_dc, timeAxis->valueAt(scenePos));
SetpointDialog::instance()->show();
}
void ProfileWidget2::changeGas()
{
QAction *action = qobject_cast<QAction *>(sender());