mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Map: reload on selection change directly
When changing the dive selection, we have to reload the map to show the correctly highlighted flags. Do this directly by hooking into the DiveListNotifier::divesChanged signal instead of indirectly via the MainTab. Moreover, on reload center on the highlighted dive sites. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									48b8129137
								
							
						
					
					
						commit
						d4a91a52fa
					
				
					 5 changed files with 12 additions and 12 deletions
				
			
		|  | @ -6,7 +6,6 @@ | |||
| 
 | ||||
| #include "mapwidget.h" | ||||
| #include "core/divesite.h" | ||||
| #include "core/subsurface-qt/DiveListNotifier.h" | ||||
| #include "map-widget/qmlmapwidgethelper.h" | ||||
| #include "qt-models/maplocationmodel.h" | ||||
| #include "qt-models/divelocationmodel.h" | ||||
|  | @ -31,6 +30,7 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent) | |||
| 	setResizeMode(QQuickWidget::SizeRootObjectToView); | ||||
| 	connect(this, &QQuickWidget::statusChanged, this, &MapWidget::doneLoading); | ||||
| 	connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &MapWidget::diveSiteChanged); | ||||
| 	connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &MapWidget::divesChanged); | ||||
| 	setSource(urlMapWidget); | ||||
| } | ||||
| 
 | ||||
|  | @ -85,8 +85,10 @@ void MapWidget::repopulateLabels() | |||
| void MapWidget::reload() | ||||
| { | ||||
| 	CHECK_IS_READY_RETURN_VOID(); | ||||
| 	if (!skipReload) | ||||
| 	if (!skipReload) { | ||||
| 		m_mapHelper->reloadMapLocations(); | ||||
| 		centerOnSelectedDiveSite(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void MapWidget::endGetDiveCoordinates() | ||||
|  | @ -129,6 +131,12 @@ void MapWidget::diveSiteChanged(struct dive_site *ds, int field) | |||
| 		m_mapHelper->updateDiveSiteCoordinates(ds, ds->location); | ||||
| } | ||||
| 
 | ||||
| void MapWidget::divesChanged(dive_trip *, const QVector<dive *> &, DiveField field) | ||||
| { | ||||
| 	if (field == DiveField::DIVESITE) | ||||
| 		reload(); | ||||
| } | ||||
| 
 | ||||
| MapWidget::~MapWidget() | ||||
| { | ||||
| 	m_instance = NULL; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue