summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveStatistics.cpp11
-rw-r--r--desktop-widgets/tab-widgets/TabDiveStatistics.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
index ffc2ad79e..83df3ab2c 100644
--- a/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveStatistics.cpp
@@ -22,6 +22,9 @@ TabDiveStatistics::TabDiveStatistics(QWidget *parent) : TabBase(parent), ui(new
ui->timeLimits->overrideAvgToolTipText(tr("Average length of all selected dives"));
connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &TabDiveStatistics::divesChanged);
+ connect(&diveListNotifier, &DiveListNotifier::cylinderAdded, this, &TabDiveStatistics::cylinderChanged);
+ connect(&diveListNotifier, &DiveListNotifier::cylinderRemoved, this, &TabDiveStatistics::cylinderChanged);
+ connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &TabDiveStatistics::cylinderChanged);
const auto l = findChildren<QLabel *>(QString(), Qt::FindDirectChildrenOnly);
for (QLabel *label: l) {
@@ -57,6 +60,14 @@ void TabDiveStatistics::divesChanged(const QVector<dive *> &dives, DiveField fie
updateData();
}
+void TabDiveStatistics::cylinderChanged(dive *d)
+{
+ // If the changed dive is not selected, do nothing
+ if (!d->selected)
+ return;
+ updateData();
+}
+
void TabDiveStatistics::updateData()
{
stats_t stats_selection;
diff --git a/desktop-widgets/tab-widgets/TabDiveStatistics.h b/desktop-widgets/tab-widgets/TabDiveStatistics.h
index 781478367..8d764d4ed 100644
--- a/desktop-widgets/tab-widgets/TabDiveStatistics.h
+++ b/desktop-widgets/tab-widgets/TabDiveStatistics.h
@@ -19,6 +19,7 @@ public:
private slots:
void divesChanged(const QVector<dive *> &dives, DiveField field);
+ void cylinderChanged(dive *d);
private:
Ui::TabDiveStatistics *ui;