From 5cd64d42e4980fc1b252ca14d4afa64b273f5154 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 14 Mar 2019 22:42:42 +0100 Subject: [PATCH] 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 --- qt-models/maplocationmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++;