profile: move calculations out of DiveGasPressureItem::paint()

With the same argument as for DivePercentageItem, move access
to live data out of the paint() function. Instead, calculate
colors in replot(), where the other data are calculated.

This is slightly more complicated than in DivePercentageItem,
since there are multiple polygons. Therefore, replace QPolygonF
by a vector of structures contained the position and color
of the data point.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-04 00:00:38 +01:00 committed by Dirk Hohndel
parent acee77e516
commit 0392994df0
2 changed files with 29 additions and 24 deletions

View file

@ -162,7 +162,11 @@ public:
private:
void plotPressureValue(int mbar, int sec, QFlags<Qt::AlignmentFlag> align, double offset);
void plotGasValue(int mbar, int sec, struct gasmix gasmix, QFlags<Qt::AlignmentFlag> align, double offset);
QVector<QPolygonF> polygons;
struct Entry {
QPointF pos;
QColor col;
};
std::vector<std::vector<Entry>> polygons;
};
class DiveCalculatedCeiling : public AbstractProfilePolygonItem {