From 0955a5b36a5d67454826a0a2fe58d609486faaaa Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Thu, 27 Jul 2017 23:07:37 +0300 Subject: maplocationmodel: use READ method selectedUuid Also emit the selectedUuidChanged signal. Signed-off-by: Lubomir I. Ivanov --- qt-models/maplocationmodel.cpp | 6 ++++++ qt-models/maplocationmodel.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'qt-models') diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp index 152688367..3a8db96d4 100644 --- a/qt-models/maplocationmodel.cpp +++ b/qt-models/maplocationmodel.cpp @@ -117,10 +117,16 @@ void MapLocationModel::setSelectedUuid(QVariant uuid, QVariant fromClick) { m_selectedUuid = qvariant_cast(uuid); const bool fromClickBool = qvariant_cast(fromClick); + emit selectedUuidChanged(); if (fromClickBool) emit selectedLocationChanged(getMapLocationForUuid(m_selectedUuid)); } +quint32 MapLocationModel::selectedUuid() +{ + return m_selectedUuid; +} + MapLocation *MapLocationModel::getMapLocationForUuid(quint32 uuid) { MapLocation *location = NULL; diff --git a/qt-models/maplocationmodel.h b/qt-models/maplocationmodel.h index 3da554a09..b3a059038 100644 --- a/qt-models/maplocationmodel.h +++ b/qt-models/maplocationmodel.h @@ -48,7 +48,7 @@ class MapLocationModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) - Q_PROPERTY(quint32 selectedUuid MEMBER m_selectedUuid NOTIFY selectedLocationChanged) + Q_PROPERTY(quint32 selectedUuid READ selectedUuid NOTIFY selectedUuidChanged) public: MapLocationModel(QObject *parent = NULL); @@ -64,6 +64,7 @@ public: void clear(); MapLocation *getMapLocationForUuid(quint32 uuid); Q_INVOKABLE void setSelectedUuid(QVariant uuid, QVariant fromClick = true); + quint32 selectedUuid(); protected: QHash roleNames() const; @@ -75,6 +76,7 @@ private: signals: void countChanged(int c); + void selectedUuidChanged(); void selectedLocationChanged(MapLocation *); }; -- cgit v1.2.3-70-g09d2