aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-19 22:44:33 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-19 22:44:33 +0000
commitf2a2ded04e89376874b9ec11a7e7a2a9ba8097ff (patch)
treee6013a984aa8979bc96c7eb835d702b7443462b3
parent639e079131126015dff0f745d1b5d3fc51adcecc (diff)
downloadsubsurface-f2a2ded04e89376874b9ec11a7e7a2a9ba8097ff.tar.gz
Profile: don't offer to switch to an already active tank
Adding a gas change to tank that we are already breathing from makes no sense, so let's not offer this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/profilewidget2.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 8d4d24ef2..c4ef97ddc 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -1110,6 +1110,8 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
}
}
// create the profile context menu
+ QPointF scenePos = mapToScene(event->pos());
+ struct plot_data *entry = getEntryFromPos(scenePos);
GasSelectionModel *model = GasSelectionModel::instance();
model->repopulate();
int rowCount = model->rowCount();
@@ -1121,6 +1123,8 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
action->setText(model->data(model->index(i, 0), Qt::DisplayRole).toString() + QString(tr(" (Tank %1)")).arg(i + 1));
connect(action, SIGNAL(triggered(bool)), this, SLOT(changeGas()));
action->setData(event->globalPos());
+ if (i == entry->cylinderindex)
+ action->setDisabled(true);
gasChange->addAction(action);
}
}