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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-02-01 23:17:04 +01:00 committed by Dirk Hohndel
parent e38b78b2aa
commit d63d4cd3c3
16 changed files with 207 additions and 36 deletions

View file

@ -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<dive *> &dives = items[index.bar].subitems[index.subitem].dives;
setSelection(dives, dives.empty() ? nullptr : dives.front());
return true;
}