Map: don't update map-selection in centerOnSelectedDiveSite()

To detangle this code a little bit, let centerOnSelectedDiveSite()
just do what is says: center on the selected dive sites.
Don't update the selected dive site by calling
MapLocationModel::setSelected().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-05-02 21:44:05 +02:00 committed by Dirk Hohndel
parent a35d1bd0e7
commit 7c99b3a76f

View file

@ -63,14 +63,13 @@ void MapWidgetHelper::centerOnSelectedDiveSite()
if (selDS.isEmpty()) {
// no selected dives with GPS coordinates
m_mapLocationModel->setSelected(nullptr, false);
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
} else if (selDS.size() == 1) {
centerOnDiveSite(selDS[0]);
} else if (selDS.size() > 1) {
QGeoCoordinate dsCoord (selDS[0]->location.lat.udeg * 0.000001, selDS[0]->location.lon.udeg * 0.000001);
QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, QVariant::fromValue(dsCoord)));
} else {
/* more than one dive sites with GPS selected.
* find the most top-left and bottom-right dive sites on the map coordinate system. */
m_mapLocationModel->setSelected(selDS[0], false);
qreal minLat = 0.0, minLon = 0.0, maxLat = 0.0, maxLon = 0.0;
bool start = true;
for(struct dive_site *dss: selDS) {