summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divelocationmodel.cpp9
-rw-r--r--qt-models/divelocationmodel.h4
2 files changed, 13 insertions, 0 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index b9bf5702b..03c07a5e0 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "core/units.h"
#include "qt-models/divelocationmodel.h"
+#include "core/subsurface-qt/DiveListNotifier.h"
#include "core/qthelper.h"
#include "core/divesite.h"
#include "core/metrics.h"
@@ -23,6 +24,7 @@ LocationInformationModel *LocationInformationModel::instance()
LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTableModel(obj)
{
+ connect(&diveListNotifier, &DiveListNotifier::diveSiteDiveCountChanged, this, &LocationInformationModel::diveSiteDiveCountChanged);
}
int LocationInformationModel::columnCount(const QModelIndex &) const
@@ -154,6 +156,13 @@ bool LocationInformationModel::removeRows(int row, int, const QModelIndex&)
return true;
}
+void LocationInformationModel::diveSiteDiveCountChanged(dive_site *ds)
+{
+ int idx = get_divesite_idx(ds, &dive_site_table);
+ if (idx >= 0)
+ dataChanged(createIndex(idx, NUM_DIVES), createIndex(idx, NUM_DIVES));
+}
+
GeoReferencingOptionsModel *GeoReferencingOptionsModel::instance()
{
static GeoReferencingOptionsModel *self = new GeoReferencingOptionsModel();
diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h
index 4840bff21..794056324 100644
--- a/qt-models/divelocationmodel.h
+++ b/qt-models/divelocationmodel.h
@@ -9,6 +9,9 @@
#define RECENTLY_ADDED_DIVESITE ((struct dive_site *)~0)
+struct dive;
+struct dive_trip;
+
class LocationInformationModel : public QAbstractTableModel {
Q_OBJECT
public:
@@ -30,6 +33,7 @@ public:
public slots:
void update();
QStringList allSiteNames() const;
+ void diveSiteDiveCountChanged(struct dive_site *ds);
private:
QStringList locationNames;
};