From b9673df60bcc7f3135abc6dd866c3b412be46f92 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 25 Jan 2021 15:06:53 +0100 Subject: 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 --- profile-widget/profilewidget2.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'profile-widget/profilewidget2.h') diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index 0a584bca4..2437574a1 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -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; -- cgit v1.2.3-70-g09d2