mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Equipment edit: for some reason we need a local copy of index
Calling enableEdition appears to corrupt the index that is passed into this slot. This doesn't fix the problem that we can't edit the cylinder start and end pressure of a manually added dive, but at least we no longer try to edit and invalid index. See #582 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									48e059c49d
								
							
						
					
					
						commit
						8bd16a7808
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -1083,14 +1083,16 @@ void MainTab::on_visibility_valueChanged(int value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainTab::editCylinderWidget(const QModelIndex &index)
 | 
					void MainTab::editCylinderWidget(const QModelIndex &index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						// we need a local copy or bad things happen when enableEdition() is called
 | 
				
			||||||
 | 
						QModelIndex editIndex = index;
 | 
				
			||||||
	if (cylindersModel->changed && editMode == NONE) {
 | 
						if (cylindersModel->changed && editMode == NONE) {
 | 
				
			||||||
		enableEdition();
 | 
							enableEdition();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (index.isValid() && index.column() != CylindersModel::REMOVE) {
 | 
						if (editIndex.isValid() && editIndex.column() != CylindersModel::REMOVE) {
 | 
				
			||||||
		if (editMode == NONE)
 | 
							if (editMode == NONE)
 | 
				
			||||||
			enableEdition();
 | 
								enableEdition();
 | 
				
			||||||
		ui.cylinders->edit(index);
 | 
							ui.cylinders->edit(editIndex);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue