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

@ -16,7 +16,7 @@ QMLProfile::QMLProfile(QQuickItem *parent) :
m_margin(0),
m_xOffset(0.0),
m_yOffset(0.0),
m_profileWidget(new ProfileWidget2)
m_profileWidget(new ProfileWidget2(nullptr, nullptr))
{
setAntialiasing(true);
setFlags(QQuickItem::ItemClipsChildrenToShape | QQuickItem::ItemHasContents );