statistics: convert scatter series to use QSG

The original plan to reuse the ChartPixmapItem for the
scatteritems was dumped, because it is unclear if the
textures are shared if generated for each item.

Instead, a new ChartScatterItem was created, where all
items share the same textures (one for highlighted,
one for non-highlighted). This means that the rendering
of the scatter items is now done in the chartitem.cpp
file, which feels like a layering violation. Not good,
but the easiest for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-17 22:03:27 +01:00 committed by bstoeger
parent 409f159e1d
commit b07a7fe5f1
4 changed files with 123 additions and 69 deletions

View file

@ -8,10 +8,9 @@
#include <memory>
#include <vector>
#include <QGraphicsRectItem>
class QGraphicsPixmapItem;
class QGraphicsScene;
class ChartScatterItem;
struct InformationBox;
struct StatsVariable;
struct dive;
@ -34,10 +33,10 @@ private:
std::vector<int> getItemsUnderMouse(const QPointF &f) const;
struct Item {
std::unique_ptr<QGraphicsPixmapItem> item;
std::unique_ptr<ChartScatterItem> item;
dive *d;
double pos, value;
Item(QGraphicsScene *scene, ScatterSeries *series, dive *d, double pos, double value);
Item(StatsView &view, ScatterSeries *series, dive *d, double pos, double value);
void updatePosition(ScatterSeries *series);
void highlight(bool highlight);
};