profile: pass DivePlannerPointsModel at construction time

This model is only needed when in plan mode. To enable multiple
profilewidgets at the same time (e.g. for the mobile app or
for printing), make the pointer to DivePlannerPointsModel a
member variable that is initialized at construction time.

Moreover, allow passing null as the DivePlannerPointsModel,
in which case planning will be disabled. This will be useful
for simple printing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-25 15:06:53 +01:00 committed by Dirk Hohndel
parent 94633d2156
commit b9673df60b
4 changed files with 29 additions and 36 deletions

View file

@ -38,6 +38,7 @@ class DiveRectItem;
class DepthAxis;
class DiveCartesianAxis;
class DiveProfileItem;
class DivePlannerPointsModel;
class TimeAxis;
class DiveTemperatureItem;
class DiveHeartrateItem;
@ -74,7 +75,8 @@ public:
COLUMNS
};
ProfileWidget2(QWidget *parent = 0);
// Pass null as plannerModel if no support for planning required
ProfileWidget2(DivePlannerPointsModel *plannerModel, QWidget *parent = 0);
~ProfileWidget2();
void resetZoom();
void scale(qreal sx, qreal sy);
@ -179,6 +181,7 @@ private:
void splitCurrentDC();
DivePlotDataModel *dataModel;
DivePlannerPointsModel *plannerModel; // If null, no planning supported.
int zoomLevel;
qreal zoomFactor;
bool isGrayscale;