mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	QML UI: Clear divelist model before starting new dive
When user clicks on AddDive, we should clear the model. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
This commit is contained in:
		
							parent
							
								
									8d03d26480
								
							
						
					
					
						commit
						a3bdf49b84
					
				
					 3 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -129,7 +129,7 @@ void QMLManager::saveChanges()
 | 
			
		|||
 | 
			
		||||
void QMLManager::addDive()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	DiveListModel::instance()->clearDives();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool QMLManager::saveCloudPassword() const
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -338,6 +338,11 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
 | 
			
		|||
	return roles;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DiveListModel::clearDives()
 | 
			
		||||
{
 | 
			
		||||
	m_dives.clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
DiveListModel *DiveListModel::instance()
 | 
			
		||||
{
 | 
			
		||||
	return m_instance;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -128,7 +128,7 @@ public:
 | 
			
		|||
	int rowCount(const QModelIndex &parent = QModelIndex()) const;
 | 
			
		||||
	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
 | 
			
		||||
	QHash<int, QByteArray> roleNames() const;
 | 
			
		||||
 | 
			
		||||
	void clearDives();
 | 
			
		||||
private:
 | 
			
		||||
	QList<MobileDive> m_dives;
 | 
			
		||||
	static DiveListModel *m_instance;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue