Map: explicitly reload selected map on click

When clicking on a flag
 1) The QML would call MapLocationModel::setSelected() with
    fromClick = true
 2) MapLocationModel::setSelected() would emit a signal
    selectedLocationChanged()
 3) MapWidgetHelper would catch that signal and do the actual
    processing.
Other functions would call MapLocationModel::setSelected() with
fromClick = false, which would not emit the selectedLocationChanged()
signal.

Detangle this a bit by calling the selectedLocationChanged() function
directly from QML and remove the fromClick parameter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-08-30 12:38:25 +02:00 committed by Dirk Hohndel
parent f818ac3352
commit 28cb75b73d
5 changed files with 19 additions and 16 deletions

View file

@ -193,14 +193,11 @@ void MapLocationModel::reload(QObject *map)
endResetModel();
}
void MapLocationModel::setSelected(struct dive_site *ds, bool fromClick)
void MapLocationModel::setSelected(struct dive_site *ds)
{
m_selectedDs.clear();
if (!ds)
return;
m_selectedDs.append(ds);
if (fromClick)
emit selectedLocationChanged(getMapLocation(ds));
if (ds)
m_selectedDs.append(ds);
}
bool MapLocationModel::isSelected(const QVariant &dsVariant) const