mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Add helper to remove dive from model
I tried various things to do this from QML but it just doesn't seem to work at all. So I gave up and instead added a trivial helper function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									957f03f2a4
								
							
						
					
					
						commit
						9f7ecbb53e
					
				
					 4 changed files with 19 additions and 1 deletions
				
			
		|  | @ -52,6 +52,16 @@ void DiveListModel::removeDive(int i) | |||
| 	endRemoveRows(); | ||||
| } | ||||
| 
 | ||||
| void DiveListModel::removeDiveById(int id) | ||||
| { | ||||
| 	for (int i = 0; i < rowCount(); i++) { | ||||
| 		if (m_dives.at(i)->id() == id) { | ||||
| 			removeDive(i); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void DiveListModel::updateDive(int i, dive *d) | ||||
| { | ||||
| 	DiveObjectHelper *newDive = new DiveObjectHelper(d); | ||||
|  | @ -125,6 +135,7 @@ DiveListModel *DiveListModel::instance() | |||
| 	return m_instance; | ||||
| } | ||||
| 
 | ||||
| DiveObjectHelper* DiveListModel::at(int i){ | ||||
| DiveObjectHelper* DiveListModel::at(int i) | ||||
| { | ||||
| 	return m_dives.at(i); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue