summaryrefslogtreecommitdiffstats
path: root/qt-models/maplocationmodel.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-24 17:00:06 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commit5ea702199bba685e78c9592b4016dc3afed12833 (patch)
treed6d968e0e791f0504ccaaf559a03f7db36f30bf7 /qt-models/maplocationmodel.cpp
parent747f3d8cab5c9021a2f3f142e06ee3beaef164e8 (diff)
downloadsubsurface-5ea702199bba685e78c9592b4016dc3afed12833.tar.gz
maplocationmodel: make setSelectedUuid() accept "fromClick" flag
The idea of this flag is to be able to only to emit the selectedLocationChanged() signal when the user clicked on the map (fromClick == true). MapWidgetHelper::selectedLocationChanged() listens for this signal and only then it will select nearby dives based on a "small-cicle". If "fromClick" is false, it's the backend or the dive list that updated the selection and MapWidgetHelper::selectedLocationChanged() should no be called. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-models/maplocationmodel.cpp')
-rw-r--r--qt-models/maplocationmodel.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp
index 5ae3609e3..52841400d 100644
--- a/qt-models/maplocationmodel.cpp
+++ b/qt-models/maplocationmodel.cpp
@@ -93,15 +93,12 @@ void MapLocationModel::clear()
endRemoveRows();
}
-quint32 MapLocationModel::selectedUuid()
+void MapLocationModel::setSelectedUuid(QVariant uuid, QVariant fromClick)
{
- return m_selectedUuid;
-}
-
-void MapLocationModel::setSelectedUuid(quint32 uuid)
-{
- m_selectedUuid = uuid;
- emit selectedLocationChanged(getMapLocationForUuid(uuid));
+ m_selectedUuid = qvariant_cast<quint32>(uuid);
+ const bool fromClickBool = qvariant_cast<bool>(fromClick);
+ if (fromClickBool)
+ emit selectedLocationChanged(getMapLocationForUuid(m_selectedUuid));
}
MapLocation *MapLocationModel::getMapLocationForUuid(quint32 uuid)