diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-03-14 22:42:42 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-03-15 07:40:13 -0700 |
commit | 5cd64d42e4980fc1b252ca14d4afa64b273f5154 (patch) | |
tree | 57f36c01a8ff07f0d48684d8cea4792e1222a3e7 /qt-models | |
parent | bc9a62c0ff42ff6ca98a7fc45a326eded9ba23bb (diff) | |
download | subsurface-5cd64d42e4980fc1b252ca14d4afa64b273f5154.tar.gz |
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>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/maplocationmodel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp index 960636260..e1e79d435 100644 --- a/qt-models/maplocationmodel.cpp +++ b/qt-models/maplocationmodel.cpp @@ -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++; |