From d85b3217840656bf371cd64264ee472a68c3141a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 31 Jan 2021 20:48:12 +0100 Subject: 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 --- stats/statsview.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'stats/statsview.cpp') 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 &dives) +{ + if (isVisible()) { + for (auto &series: series) + series->divesSelected(dives); + } + update(); +} + void StatsView::mouseMoveEvent(QMouseEvent *event) { if (!draggedItem) -- cgit v1.2.3-70-g09d2