mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Map: automatically update names on the map
Currently, dive site names are only updated on full reload. Instead hook directly into the corresponding signal in the MapLocationModel to set the name. Also to the coordinates directly there instead of going via the MapWidgetHelper. In the MapWidgetHelper, just center on the changed dive site. Hook into the signal directly there and remove the slot from the MapWidget. This makes the whole call-chain at least one call shorter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
30d96d3704
commit
44c65fec88
6 changed files with 39 additions and 31 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#ifndef MAPLOCATIONMODEL_H
|
||||
#define MAPLOCATIONMODEL_H
|
||||
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
#include <QHash>
|
||||
|
|
@ -64,7 +65,6 @@ public:
|
|||
void reload(QObject *map);
|
||||
MapLocation *getMapLocation(const struct dive_site *ds);
|
||||
const QVector<dive_site *> &selectedDs() const;
|
||||
void updateMapLocationCoordinates(const struct dive_site *ds, QGeoCoordinate coord);
|
||||
Q_INVOKABLE void setSelected(struct dive_site *ds, bool fromClick = true);
|
||||
// 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.
|
||||
|
|
@ -73,6 +73,9 @@ public:
|
|||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
private slots:
|
||||
void diveSiteChanged(struct dive_site *ds, int field);
|
||||
|
||||
private:
|
||||
QVector<MapLocation *> m_mapLocations;
|
||||
QHash<int, QByteArray> m_roles;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue