summaryrefslogtreecommitdiffstats
path: root/qt-models/maplocationmodel.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-05-02 00:09:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-05-11 12:06:19 -0700
commita35d1bd0e79e83b5ef49b76087e7cfe5a38d829c (patch)
treedcacd763679c0fe2c9ce267f3c21dadc9c99393f /qt-models/maplocationmodel.h
parent446dfed6e72971ed91df9378bd5b7b34c90b690a (diff)
downloadsubsurface-a35d1bd0e79e83b5ef49b76087e7cfe5a38d829c.tar.gz
Map: show multiple selected dive sites
If multiple dives are selected, highlight all corresponding sites. For that, replace the MapLocationModel::m_selectedDs pointer by a QVector<>. Fill the vector in MapLocationModel::reload() and add a isSelected() member function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/maplocationmodel.h')
-rw-r--r--qt-models/maplocationmodel.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/qt-models/maplocationmodel.h b/qt-models/maplocationmodel.h
index 6c28c6c99..6f075cc84 100644
--- a/qt-models/maplocationmodel.h
+++ b/qt-models/maplocationmodel.h
@@ -50,7 +50,6 @@ class MapLocationModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QVariant selectedDs READ selectedDs NOTIFY selectedDsChanged)
public:
MapLocationModel(QObject *parent = NULL);
@@ -65,7 +64,9 @@ public:
MapLocation *getMapLocation(const struct dive_site *ds);
void updateMapLocationCoordinates(const struct dive_site *ds, QGeoCoordinate coord);
Q_INVOKABLE void setSelected(struct dive_site *ds, bool fromClick = true);
- QVariant selectedDs();
+ // The dive site is passed as a QVariant, because a null-QVariant is not automatically
+ // transformed into a null pointer and warning messages are spewed onto the console.
+ Q_INVOKABLE bool isSelected(const QVariant &ds) const;
protected:
QHash<int, QByteArray> roleNames() const override;
@@ -73,11 +74,10 @@ protected:
private:
QVector<MapLocation *> m_mapLocations;
QHash<int, QByteArray> m_roles;
- struct dive_site *m_selectedDs;
+ QVector<dive_site *> m_selectedDs;
signals:
void countChanged(int c);
- void selectedDsChanged();
void selectedLocationChanged(MapLocation *);
};