mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:50:04 +00:00 
			
		
		
		
	Move MarkerManager to using an ID system for markers, instead of index
This commit is contained in:
		
							parent
							
								
									236d7c1e35
								
							
						
					
					
						commit
						7a070b3e7f
					
				
					 8 changed files with 233 additions and 74 deletions
				
			
		|  | @ -65,21 +65,25 @@ void MarkerSettingsWidgetImpl::ConnectSignals() | |||
|                     { | ||||
|                        markerManager_->add_marker(types::MarkerInfo("", 0, 0)); | ||||
|                     }); | ||||
|    QObject::connect(self_->ui->removeButton, | ||||
|                     &QPushButton::clicked, | ||||
|                     self_, | ||||
|                     [this]() | ||||
|                     { | ||||
|                        auto selectionModel = | ||||
|                           self_->ui->markerView->selectionModel(); | ||||
|                        QModelIndex selected = | ||||
|                           selectionModel | ||||
|                              ->selectedRows(static_cast<int>( | ||||
|                                 model::MarkerModel::Column::Name)) | ||||
|                              .first(); | ||||
|    QObject::connect( | ||||
|       self_->ui->removeButton, | ||||
|       &QPushButton::clicked, | ||||
|       self_, | ||||
|       [this]() | ||||
|       { | ||||
|          auto        selectionModel = self_->ui->markerView->selectionModel(); | ||||
|          QModelIndex selected       = selectionModel | ||||
|                                    ->selectedRows(static_cast<int>( | ||||
|                                       model::MarkerModel::Column::Name)) | ||||
|                                    .first(); | ||||
|          std::optional<types::MarkerId> id = markerModel_->getId(selected.row()); | ||||
|          if (!id) | ||||
|          { | ||||
|             return; | ||||
|          } | ||||
| 
 | ||||
|                        markerManager_->remove_marker(selected.row()); | ||||
|                     }); | ||||
|          markerManager_->remove_marker(*id); | ||||
|       }); | ||||
|    QObject::connect( | ||||
|       self_->ui->markerView->selectionModel(), | ||||
|       &QItemSelectionModel::selectionChanged, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak