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,14 +40,18 @@ int DiveHandler::parentIndex()
|
|||
void DiveHandler::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
QMenu m;
|
||||
GasSelectionModel *model = GasSelectionModel::instance();
|
||||
model->repopulate();
|
||||
int rowCount = model->rowCount();
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
QAction *action = new QAction(&m);
|
||||
action->setText(model->data(model->index(i, 0), Qt::DisplayRole).toString());
|
||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(changeGas()));
|
||||
m.addAction(action);
|
||||
// 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();
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
QAction *action = new QAction(&m);
|
||||
action->setText(model->data(model->index(i, 0), Qt::DisplayRole).toString());
|
||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(changeGas()));
|
||||
m.addAction(action);
|
||||
}
|
||||
}
|
||||
// don't allow removing the last point
|
||||
if (plannerModel->rowCount() > 1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue