mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Don't offer to add a gas change if there is ony one gas
In the context menu of the profile it makes no sense to offer the ability to switch gases unless there is a gas to switch to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									9848760821
								
							
						
					
					
						commit
						76c44dd6a3
					
				
					 1 changed files with 10 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -1096,10 +1096,12 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// create the profile context menu
 | 
			
		||||
	QMenu *gasChange = m.addMenu(tr("Add gas change"));
 | 
			
		||||
	GasSelectionModel *model = GasSelectionModel::instance();
 | 
			
		||||
	model->repopulate();
 | 
			
		||||
	int rowCount = model->rowCount();
 | 
			
		||||
	if (rowCount > 1) {
 | 
			
		||||
		// if we have more than one gas, offer to switch to another one
 | 
			
		||||
		QMenu *gasChange = m.addMenu(tr("Add gas change"));
 | 
			
		||||
		for (int i = 0; i < rowCount; i++) {
 | 
			
		||||
			QAction *action = new QAction(&m);
 | 
			
		||||
			action->setText(model->data(model->index(i, 0), Qt::DisplayRole).toString() + QString(tr(" (Tank %1)")).arg(i + 1));
 | 
			
		||||
| 
						 | 
				
			
			@ -1107,6 +1109,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
 | 
			
		|||
			action->setData(event->globalPos());
 | 
			
		||||
			gasChange->addAction(action);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	QAction *action = m.addAction(tr("Add bookmark"), this, SLOT(addBookmark()));
 | 
			
		||||
	action->setData(event->globalPos());
 | 
			
		||||
	if (DiveEventItem *item = dynamic_cast<DiveEventItem *>(sceneItem)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue