summaryrefslogtreecommitdiffstats
path: root/qt-models/maplocationmodel.h
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-27 22:43:10 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commit2dea6f514696ea8e740c9028b7426f958bfb2c96 (patch)
tree112f902e33c8d1e4e8fdd171380dd8136bad3219 /qt-models/maplocationmodel.h
parentf7095aa89e9d27e006a6d75564ba5b9fa63554a5 (diff)
downloadsubsurface-2dea6f514696ea8e740c9028b7426f958bfb2c96.tar.gz
maplocation: add helpers for coordinate and uuid
getRole() returns a QVariant and the cast is a small overhead. Using these helpers will reduce the overhead. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-models/maplocationmodel.h')
-rw-r--r--qt-models/maplocationmodel.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-models/maplocationmodel.h b/qt-models/maplocationmodel.h
index 9076de21d..3da554a09 100644
--- a/qt-models/maplocationmodel.h
+++ b/qt-models/maplocationmodel.h
@@ -12,8 +12,8 @@
class MapLocation : public QObject
{
Q_OBJECT
- Q_PROPERTY(quint32 uuid MEMBER m_uuid)
- Q_PROPERTY(QGeoCoordinate coordinate MEMBER m_coordinate)
+ Q_PROPERTY(quint32 uuid READ uuid)
+ Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
Q_PROPERTY(QString name MEMBER m_name)
public:
@@ -25,6 +25,9 @@ public:
explicit MapLocation(quint32 uuid, QGeoCoordinate coord, QString name);
QVariant getRole(int role) const;
+ QGeoCoordinate coordinate();
+ void setCoordinate(QGeoCoordinate coord);
+ quint32 uuid();
enum Roles {
RoleUuid = Qt::UserRole + 1,
@@ -36,6 +39,9 @@ private:
quint32 m_uuid;
QGeoCoordinate m_coordinate;
QString m_name;
+
+signals:
+ void coordinateChanged();
};
class MapLocationModel : public QAbstractListModel