mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	map-widget: start dive site editing with coords pre-entered
Once the user starts editing a dive site, make sure to pass coordinates of either the current map center (if a new MapLocation is being added) or the coordinates of the existing MapLocation. The "Dive site management" coordinates text field would receive these new coordinates after the displayed_dive_site struct is updated and the coordinatesChanged() signal is emitted. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
		
							parent
							
								
									d9cfcae88b
								
							
						
					
					
						commit
						b564debe21
					
				
					 1 changed files with 13 additions and 5 deletions
				
			
		| 
						 | 
					@ -238,11 +238,19 @@ void MapWidgetHelper::setEditMode(bool editMode)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	m_editMode = editMode;
 | 
						m_editMode = editMode;
 | 
				
			||||||
	MapLocation *exists = m_mapLocationModel->getMapLocationForUuid(displayed_dive_site.uuid);
 | 
						MapLocation *exists = m_mapLocationModel->getMapLocationForUuid(displayed_dive_site.uuid);
 | 
				
			||||||
	// if divesite uuid doesn't exist in the model, add a new MapLocation.
 | 
						if (editMode) {
 | 
				
			||||||
	if (editMode && !exists) {
 | 
							QGeoCoordinate coord;
 | 
				
			||||||
		QGeoCoordinate coord = m_map->property("center").value<QGeoCoordinate>();
 | 
							// if divesite uuid doesn't exist in the model, add a new MapLocation.
 | 
				
			||||||
		m_mapLocationModel->add(new MapLocation(displayed_dive_site.uuid, coord,
 | 
							if (!exists) {
 | 
				
			||||||
		                                        QString(displayed_dive_site.name)));
 | 
								coord = m_map->property("center").value<QGeoCoordinate>();
 | 
				
			||||||
 | 
								m_mapLocationModel->add(new MapLocation(displayed_dive_site.uuid, coord,
 | 
				
			||||||
 | 
								                                        QString(displayed_dive_site.name)));
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								coord = exists->coordinate();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							displayed_dive_site.latitude.udeg = lrint(coord.latitude() * 1000000.0);
 | 
				
			||||||
 | 
							displayed_dive_site.longitude.udeg = lrint(coord.longitude() * 1000000.0);
 | 
				
			||||||
 | 
							emit coordinatesChanged();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	emit editModeChanged();
 | 
						emit editModeChanged();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue