mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Show cylinders up to and including the last valid
Previous code aborted at the first invalid cylinder. This instead finds the last valid and prints all the ones up until that one. Fixes #295 Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									27bfc587cf
								
							
						
					
					
						commit
						ab4115791b
					
				
					 1 changed files with 5 additions and 8 deletions
				
			
		|  | @ -353,19 +353,16 @@ void CylindersModel::setDive(dive* d) | |||
| 		clear(); | ||||
| 	if (!d) | ||||
| 		return; | ||||
| 	int amount = MAX_CYLINDERS; | ||||
| 	rows = 0; | ||||
| 	for(int i = 0; i < MAX_CYLINDERS; i++) { | ||||
| 		cylinder_t *cylinder = &d->cylinder[i]; | ||||
| 		if (cylinder_none(cylinder)) { | ||||
| 			amount = i; | ||||
| 			break; | ||||
| 		if (!cylinder_none(&d->cylinder[i])) { | ||||
| 			rows = i+1; | ||||
| 		} | ||||
| 	} | ||||
| 	rows = amount; | ||||
| 	current = d; | ||||
| 	changed = false; | ||||
| 	if (amount > 0) { | ||||
| 		beginInsertRows(QModelIndex(), 0, amount - 1); | ||||
| 	if (rows > 0) { | ||||
| 		beginInsertRows(QModelIndex(), 0, rows-1); | ||||
| 		endInsertRows(); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue