From fb265c292994d9afa252b5236a805f84cb0d4554 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Wed, 26 Nov 2014 14:22:41 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'qt-ui/profile/profilewidget2.cpp') diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index e1892b2fa..347cc1bf8 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -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(sceneItem)) { @@ -1282,6 +1284,14 @@ void ProfileWidget2::addBookmark() replot(); } +void ProfileWidget2::addSetpointChange() +{ + QAction *action = qobject_cast(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(sender()); -- cgit v1.2.3-70-g09d2