mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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)
|
void MapLocationModel::setSelectedUuid(quint32 uuid)
|
||||||
{
|
{
|
||||||
m_selectedUuid = uuid;
|
m_selectedUuid = uuid;
|
||||||
|
emit selectedLocationChanged(getMapLocationForUuid(uuid));
|
||||||
|
}
|
||||||
|
|
||||||
|
MapLocation *MapLocationModel::getMapLocationForUuid(quint32 uuid)
|
||||||
|
{
|
||||||
MapLocation *location = NULL;
|
MapLocation *location = NULL;
|
||||||
foreach(location, m_mapLocations) {
|
foreach(location, m_mapLocations) {
|
||||||
if (location->getRole(MapLocation::Roles::RoleUuid) == uuid)
|
if (location->getRole(MapLocation::Roles::RoleUuid) == uuid)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
emit selectedLocationChanged(location);
|
return location;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
void add(MapLocation *);
|
void add(MapLocation *);
|
||||||
void addList(QVector<MapLocation *>);
|
void addList(QVector<MapLocation *>);
|
||||||
void clear();
|
void clear();
|
||||||
|
MapLocation *getMapLocationForUuid(quint32 uuid);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const;
|
QHash<int, QByteArray> roleNames() const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue