From d63d4cd3c357a4294e4810ad320acf519b37882d Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 1 Feb 2021 23:17:04 +0100 Subject: statistics: implement rectangle selection in scatter plot Allow the user to select regions of the scatter plot using a rectangular selection. When shift is pressed, do an incremental selection. Unfortunately, the list-selection code is so slow that this becomes unusable for a large number of selected dives. Signed-off-by: Berthold Stoeger --- stats/barseries.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'stats/barseries.cpp') diff --git a/stats/barseries.cpp b/stats/barseries.cpp index ad956c454..58c6511a6 100644 --- a/stats/barseries.cpp +++ b/stats/barseries.cpp @@ -406,12 +406,15 @@ void BarSeries::unhighlight() highlighted = Index(); } -void BarSeries::selectItemsUnderMouse(const QPointF &pos, bool) +bool BarSeries::selectItemsUnderMouse(const QPointF &pos, bool) { Index index = getItemUnderMouse(pos); - if (index.bar < 0) - return setSelection({}, nullptr); + if (index.bar < 0) { + setSelection({}, nullptr); + return false; + } const std::vector &dives = items[index.bar].subitems[index.subitem].dives; setSelection(dives, dives.empty() ? nullptr : dives.front()); + return true; } -- cgit v1.2.3-70-g09d2