summaryrefslogtreecommitdiffstats
path: root/stats/scatterseries.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'stats/scatterseries.cpp')
-rw-r--r--stats/scatterseries.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/stats/scatterseries.cpp b/stats/scatterseries.cpp
index d5bf69ebb..f88837288 100644
--- a/stats/scatterseries.cpp
+++ b/stats/scatterseries.cpp
@@ -27,6 +27,7 @@ ScatterSeries::~ScatterSeries()
ScatterSeries::Item::Item(StatsView &view, ScatterSeries *series, dive *d, double pos, double value) :
item(view.createChartItem<ChartScatterItem>(ChartZValue::Series)),
d(d),
+ selected(d->selected),
pos(pos),
value(value)
{
@@ -40,7 +41,11 @@ void ScatterSeries::Item::updatePosition(ScatterSeries *series)
void ScatterSeries::Item::highlight(bool highlight)
{
- item->setHighlight(highlight);
+ ChartScatterItem::Highlight status = d->selected ?
+ ChartScatterItem::Highlight::Selected : ChartScatterItem::Highlight::Unselected;
+ if (highlight)
+ status = ChartScatterItem::Highlight::Highlighted;
+ item->setHighlight(status);
}
void ScatterSeries::append(dive *d, double pos, double value)
@@ -164,3 +169,15 @@ void ScatterSeries::unhighlight()
items[idx].highlight(false);
highlighted.clear();
}
+
+void ScatterSeries::divesSelected(const QVector<dive *> &)
+{
+ for (Item &item: items) {
+ if (item.selected != item.d->selected) {
+ item.selected = item.d->selected;
+ int idx = &item - &items[0];
+ bool highlight = std::find(highlighted.begin(), highlighted.end(), idx) != highlighted.end();
+ item.highlight(highlight);
+ }
+ }
+}