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>
This commit is contained in:
Dirk Hohndel 2014-11-19 22:44:33 +00:00
parent 639e079131
commit f2a2ded04e

View file

@ -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);
}
}