summaryrefslogtreecommitdiffstats
path: root/qt-models/maplocationmodel.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-19 03:02:34 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commit4a126b553f218b0a695b3709f099ac81fa53b1d8 (patch)
tree6e50e145433b4311c9e2d823e8a5ec2954e164d8 /qt-models/maplocationmodel.cpp
parenta920d683a196ff28be3e8fa9bbaaab2a67b05553 (diff)
downloadsubsurface-4a126b553f218b0a695b3709f099ac81fa53b1d8.tar.gz
maplocationmodel: add the helper method getMapLocationForUuid()
getMapLocationForUuid() accepts a UUID, searches the MapLocation table and returns a pointer. Make use of the new method in setSelectedUuid(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-models/maplocationmodel.cpp')
-rw-r--r--qt-models/maplocationmodel.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp
index e01b46621..5ae3609e3 100644
--- a/qt-models/maplocationmodel.cpp
+++ b/qt-models/maplocationmodel.cpp
@@ -101,10 +101,15 @@ quint32 MapLocationModel::selectedUuid()
void MapLocationModel::setSelectedUuid(quint32 uuid)
{
m_selectedUuid = uuid;
+ emit selectedLocationChanged(getMapLocationForUuid(uuid));
+}
+
+MapLocation *MapLocationModel::getMapLocationForUuid(quint32 uuid)
+{
MapLocation *location = NULL;
foreach(location, m_mapLocations) {
if (location->getRole(MapLocation::Roles::RoleUuid) == uuid)
break;
}
- emit selectedLocationChanged(location);
+ return location;
}