Map: create correct index in updateMapLocationCoordinates()

When updating the coordinates of a dive site, the MapLocationModel
is updated. The code created a (col, row) index with col = 0.
[The idea of course being col = x, row = y]. Alas, that's not
how Qt works - its models want (row, col) indices. The code
worked, because the only time when the dive site locations were
updated was in dive site edit mode, when only one site is visible,
i.e. there is only one row leading to the correct (0, 0) index.

Fix this so that we can also change dive site positions if more
than one site is displayed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-03-14 22:42:42 +01:00 committed by Dirk Hohndel
parent bc9a62c0ff
commit 5cd64d42e4

View file

@ -155,7 +155,7 @@ void MapLocationModel::updateMapLocationCoordinates(const struct dive_site *ds,
foreach(location, m_mapLocations) {
if (ds == location->divesite()) {
location->setCoordinateNoEmit(coord);
emit dataChanged(createIndex(0, row), createIndex(0, row));
emit dataChanged(createIndex(row, 0), createIndex(row, 0));
return;
}
row++;