aboutsummaryrefslogtreecommitdiffstats
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.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index b01ae03b6..fbeab7be8 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -27,6 +27,7 @@ LocationInformationModel::LocationInformationModel(QObject *obj) : QAbstractTabl
connect(&diveListNotifier, &DiveListNotifier::diveSiteAdded, this, &LocationInformationModel::diveSiteAdded);
connect(&diveListNotifier, &DiveListNotifier::diveSiteDeleted, this, &LocationInformationModel::diveSiteDeleted);
connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &LocationInformationModel::diveSiteChanged);
+ connect(&diveListNotifier, &DiveListNotifier::diveSiteDivesChanged, this, &LocationInformationModel::diveSiteDivesChanged);
}
int LocationInformationModel::columnCount(const QModelIndex &) const
@@ -167,6 +168,14 @@ void LocationInformationModel::diveSiteChanged(struct dive_site *ds, int field)
dataChanged(createIndex(idx, field), createIndex(idx, field));
}
+void LocationInformationModel::diveSiteDivesChanged(struct dive_site *ds)
+{
+ int idx = get_divesite_idx(ds, &dive_site_table);
+ if (idx < 0)
+ return;
+ dataChanged(createIndex(idx, NUM_DIVES), createIndex(idx, NUM_DIVES));
+}
+
bool DiveSiteSortedModel::filterAcceptsRow(int sourceRow, const QModelIndex &source_parent) const
{
// TODO: filtering
diff --git a/qt-models/divelocationmodel.h b/qt-models/divelocationmodel.h
index bca833a06..9f1c4468b 100644
--- a/qt-models/divelocationmodel.h
+++ b/qt-models/divelocationmodel.h
@@ -35,6 +35,7 @@ public slots:
void diveSiteAdded(struct dive_site *ds, int idx);
void diveSiteDeleted(struct dive_site *ds, int idx);
void diveSiteChanged(struct dive_site *ds, int field);
+ void diveSiteDivesChanged(struct dive_site *ds);
};
class DiveSiteSortedModel : public QSortFilterProxyModel {