mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't offer gas selection for the last waypoint in planner
Since the gas selection list on a waypoint refers to a gaschange there influencing the following segments, there must not be a gas selection on the last manually entered waypoint since from there the planner handles the gas selection. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f93c60fc1e
commit
5a1c041b78
1 changed files with 12 additions and 8 deletions
|
@ -40,6 +40,9 @@ int DiveHandler::parentIndex()
|
|||
void DiveHandler::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
QMenu m;
|
||||
// Don't have a gas selection for the last point
|
||||
QModelIndex index = plannerModel->index(parentIndex(), DivePlannerPointsModel::GAS);
|
||||
if (index.sibling(index.row() + 1, index.column()).isValid()) {
|
||||
GasSelectionModel *model = GasSelectionModel::instance();
|
||||
model->repopulate();
|
||||
int rowCount = model->rowCount();
|
||||
|
@ -49,6 +52,7 @@ void DiveHandler::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
connect(action, SIGNAL(triggered(bool)), this, SLOT(changeGas()));
|
||||
m.addAction(action);
|
||||
}
|
||||
}
|
||||
// don't allow removing the last point
|
||||
if (plannerModel->rowCount() > 1) {
|
||||
m.addSeparator();
|
||||
|
|
Loading…
Add table
Reference in a new issue