diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-02-10 12:15:14 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-02-13 13:02:54 -0800 |
commit | 43b0ccca3e8db081378d0924de257b4185b90464 (patch) | |
tree | 1bebf8867bb6515bac6dd7d596c726b6e4729a1d /stats/boxseries.cpp | |
parent | 64b82b16a26bcaa624cc35e775b821e33133bdbb (diff) | |
download | subsurface-43b0ccca3e8db081378d0924de257b4185b90464.tar.gz |
statistics: support ctrl-selection for all series
Multiple selection using ctrl was only supported for
scatter series. Factor out the corresponding code and
use it in all series.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/boxseries.cpp')
-rw-r--r-- | stats/boxseries.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/stats/boxseries.cpp b/stats/boxseries.cpp index 09f9ccf9c..1bbfa2cfc 100644 --- a/stats/boxseries.cpp +++ b/stats/boxseries.cpp @@ -146,17 +146,16 @@ void BoxSeries::unhighlight() highlighted = -1; } -bool BoxSeries::selectItemsUnderMouse(const QPointF &pos, SelectionModifier) +bool BoxSeries::selectItemsUnderMouse(const QPointF &pos, SelectionModifier modifier) { int index = getItemUnderMouse(pos); - if (index < 0) { - setSelection({}, nullptr); - return false; - } - const std::vector<dive *> &dives = items[index]->q.dives; - setSelection(dives, dives.empty() ? nullptr : dives.front()); - return true; + std::vector<dive *> divesUnderMouse; + if (index >= 0) + divesUnderMouse = items[index]->q.dives; + processSelection(std::move(divesUnderMouse), modifier); + + return index >= 0; } void BoxSeries::divesSelected(const QVector<dive *> &) |