mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Placefile "Remove" functionality
This commit is contained in:
		
							parent
							
								
									9955c4ccbe
								
							
						
					
					
						commit
						ad5c2b583d
					
				
					 6 changed files with 115 additions and 2 deletions
				
			
		|  | @ -45,6 +45,11 @@ PlacefileModel::PlacefileModel(QObject* parent) : | |||
|            this, | ||||
|            &PlacefileModel::HandlePlacefileUpdate); | ||||
| 
 | ||||
|    connect(p->placefileManager_.get(), | ||||
|            &manager::PlacefileManager::PlacefileRemoved, | ||||
|            this, | ||||
|            &PlacefileModel::HandlePlacefileRemoved); | ||||
| 
 | ||||
|    connect(p->placefileManager_.get(), | ||||
|            &manager::PlacefileManager::PlacefileRenamed, | ||||
|            this, | ||||
|  | @ -292,6 +297,24 @@ bool PlacefileModel::setData(const QModelIndex& index, | |||
|    return true; | ||||
| } | ||||
| 
 | ||||
| void PlacefileModel::HandlePlacefileRemoved(const std::string& name) | ||||
| { | ||||
|    auto it = | ||||
|       std::find(p->placefileNames_.begin(), p->placefileNames_.end(), name); | ||||
| 
 | ||||
|    if (it != p->placefileNames_.end()) | ||||
|    { | ||||
|       // Placefile exists, delete row
 | ||||
|       const int   row         = std::distance(p->placefileNames_.begin(), it); | ||||
|       QModelIndex topLeft     = createIndex(row, kFirstColumn); | ||||
|       QModelIndex bottomRight = createIndex(row, kLastColumn); | ||||
| 
 | ||||
|       beginRemoveRows(QModelIndex(), row, row); | ||||
|       p->placefileNames_.erase(it); | ||||
|       endRemoveRows(); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| void PlacefileModel::HandlePlacefileRenamed(const std::string& oldName, | ||||
|                                             const std::string& newName) | ||||
| { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat