mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 19:23:24 +00:00
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>
This commit is contained in:
parent
a920d683a1
commit
4a126b553f
2 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
void add(MapLocation *);
|
||||
void addList(QVector<MapLocation *>);
|
||||
void clear();
|
||||
MapLocation *getMapLocationForUuid(quint32 uuid);
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue