summaryrefslogtreecommitdiffstats
path: root/stats/statsview.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-31 20:48:12 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-02-13 13:02:54 -0800
commitd85b3217840656bf371cd64264ee472a68c3141a (patch)
tree8f5a9ffb3e956c1b262b3a36e88e0b0895b09878 /stats/statsview.cpp
parent5c098eea29fdb1cd663b78db4e430a1c76c2209a (diff)
downloadsubsurface-d85b3217840656bf371cd64264ee472a68c3141a.tar.gz
statistics: show selected dives in scatter plot
As a visual feedback, show the selected dives in the scatter plot. React to application-wide selection changes. Currently, the dive list is deactivated while in statistics mode, but that may change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/statsview.cpp')
-rw-r--r--stats/statsview.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/stats/statsview.cpp b/stats/statsview.cpp
index 61d9db4a6..bf4ecdc6a 100644
--- a/stats/statsview.cpp
+++ b/stats/statsview.cpp
@@ -46,6 +46,7 @@ StatsView::StatsView(QQuickItem *parent) : QQuickItem(parent),
connect(&diveListNotifier, &DiveListNotifier::divesDeleted, this, &StatsView::replotIfVisible);
connect(&diveListNotifier, &DiveListNotifier::dataReset, this, &StatsView::replotIfVisible);
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &StatsView::replotIfVisible);
+ connect(&diveListNotifier, &DiveListNotifier::divesSelected, this, &StatsView::divesSelected);
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::LeftButton);
@@ -345,6 +346,15 @@ void StatsView::replotIfVisible()
plot(state);
}
+void StatsView::divesSelected(const QVector<dive *> &dives)
+{
+ if (isVisible()) {
+ for (auto &series: series)
+ series->divesSelected(dives);
+ }
+ update();
+}
+
void StatsView::mouseMoveEvent(QMouseEvent *event)
{
if (!draggedItem)