profile: pass print-mode add construction of ProfileScene

Setting the profile and grayscale mode of the profile via
functions is from a time when the same profile widget was
used for printing and the UI. It is simpler to set the mode
when constructing the object and not deal with changes.

To prepare for this scenario, take the flag at construction
time. This still keeps the callers as-is. These will be
adapted later.

Logically, then the printFlag also has to be set in
DiveCartesianAxis at construction time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-08-03 15:39:25 +02:00 committed by Dirk Hohndel
parent 1327043d6e
commit 84ebd1d67a
5 changed files with 23 additions and 45 deletions

View file

@ -46,7 +46,7 @@ static const double thumbnailBaseZValue = 100.0;
#endif
ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double fontPrintScale, QWidget *parent) : QGraphicsView(parent),
profileScene(new ProfileScene(fontPrintScale)),
profileScene(new ProfileScene(fontPrintScale, false, false)),
currentState(INIT),
plannerModel(plannerModelIn),
zoomLevel(0),
@ -821,16 +821,8 @@ void ProfileWidget2::setPrintMode(bool grayscale)
resetZoom();
// set printMode for axes
profileScene->profileYAxis->setPrintMode();
profileScene->gasYAxis->setPrintMode();
profileScene->temperatureAxis->setPrintMode();
profileScene->timeAxis->setPrintMode();
profileScene->cylinderPressureAxis->setPrintMode();
profileScene->isGrayscale = grayscale;
#ifndef SUBSURFACE_MOBILE
profileScene->heartBeatAxis->setPrintMode();
profileScene->percentageAxis->setPrintMode();
mouseFollowerHorizontal->setVisible(false);
mouseFollowerVertical->setVisible(false);
toolTipItem->setVisible(false);