diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-07-25 23:15:28 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-28 07:31:11 -0700 |
commit | be0d5133240f6113cced1df43b5a5f58c3eff6ed (patch) | |
tree | 99fab047a72ce753761ff2d97afbc7a68378b3ec /qt-models/maplocationmodel.cpp | |
parent | 8c7d1a1163ba22cd1b5e75b723affacc9d0cfd1c (diff) | |
download | subsurface-be0d5133240f6113cced1df43b5a5f58c3eff6ed.tar.gz |
maplocationmodel: add the "namer" property
The MapLocation QObject now has a QString property "name", which is
translating the dive_site->name member.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-models/maplocationmodel.cpp')
-rw-r--r-- | qt-models/maplocationmodel.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp index 52841400d..8ce5e3020 100644 --- a/qt-models/maplocationmodel.cpp +++ b/qt-models/maplocationmodel.cpp @@ -3,13 +3,14 @@ const char *MapLocation::PROPERTY_NAME_COORDINATE = "coordinate";
const char *MapLocation::PROPERTY_NAME_UUID = "uuid";
+const char *MapLocation::PROPERTY_NAME_NAME = "name";
MapLocation::MapLocation()
{
}
-MapLocation::MapLocation(quint32 uuid, QGeoCoordinate coord) :
- m_uuid(uuid), m_coordinate(coord)
+MapLocation::MapLocation(quint32 uuid, QGeoCoordinate coord, QString name) :
+ m_uuid(uuid), m_coordinate(coord), m_name(name)
{
}
@@ -20,6 +21,8 @@ QVariant MapLocation::getRole(int role) const return QVariant::fromValue(m_uuid);
case Roles::RoleCoordinate:
return QVariant::fromValue(m_coordinate);
+ case Roles::RoleName:
+ return QVariant::fromValue(m_name);
default:
return QVariant();
}
@@ -29,6 +32,7 @@ MapLocationModel::MapLocationModel(QObject *parent) : QAbstractListModel(parent) {
m_roles[MapLocation::Roles::RoleUuid] = MapLocation::PROPERTY_NAME_UUID;
m_roles[MapLocation::Roles::RoleCoordinate] = MapLocation::PROPERTY_NAME_COORDINATE;
+ m_roles[MapLocation::Roles::RoleName] = MapLocation::PROPERTY_NAME_NAME;
}
MapLocationModel::~MapLocationModel()
|