profile: call clearHandlers() in setPlanState()

This function, which removes the handlers from the profile, was called
in setAddState() but not in setPlanState(). In the latter case it was
called explicitly by the caller.

Move the call from the caller into the function. This allows us to
make clearHandlers() private in to the profile widget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-11-25 07:40:09 +01:00 committed by Dirk Hohndel
parent bb76cb56d4
commit 674c20227b
3 changed files with 4 additions and 2 deletions

View file

@ -663,7 +663,6 @@ void PlannerWidgets::replanDive()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
MainWindow::instance()->graphics->setPlanState();
MainWindow::instance()->graphics->clearHandlers();
plannerWidget.setReplanButton(true);
plannerWidget.setupStartTime(timestampToDateTime(current_dive->when));

View file

@ -1352,6 +1352,7 @@ void ProfileWidget2::setPlanState()
if (currentState == PLAN)
return;
clearHandlers();
setProfileState();
mouseFollowerHorizontal->setVisible(true);
mouseFollowerVertical->setVisible(true);

View file

@ -87,7 +87,6 @@ public:
void setFontPrintScale(double scale);
#ifndef SUBSURFACE_MOBILE
bool eventFilter(QObject *, QEvent *) override;
void clearHandlers();
#endif
void setToolTipVisibile(bool visible);
State currentState;
@ -164,6 +163,9 @@ private:
void createPPGas(PartialPressureGasItem *item, int verticalColumn, color_index_t color, color_index_t colorAlert,
const double *thresholdSettingsMin, const double *thresholdSettingsMax);
void clearPictures();
#ifndef SUBSURFACE_MOBILE
void clearHandlers();
#endif
void plotPicturesInternal(const struct dive *d, bool synchronous);
void addDivemodeSwitch(int seconds, int divemode);
void addBookmark(int seconds);