profile: set minimum/maximum of axes with a single call

This is bike-shedding: Instead of two setMinimum()/setMaximum()
calls, use a single setBounds() call. A few axes (notably depth
and time) always have a 0 as lower bound. However, this will
change once there is a proper zooming functionality.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-09-11 21:57:49 +02:00 committed by Dirk Hohndel
parent 0bef8167d2
commit 89d9105209
4 changed files with 13 additions and 28 deletions

View file

@ -970,7 +970,7 @@ void ProfileWidget2::divePlannerHandlerMoved()
// Grow the time axis if necessary.
int minutes = lrint(profileScene->timeAxis->valueAt(activeHandler->pos()) / 60);
if (minutes * 60 > profileScene->timeAxis->maximum() * 0.9)
profileScene->timeAxis->setMaximum(profileScene->timeAxis->maximum() * 1.02);
profileScene->timeAxis->setBounds(0.0, profileScene->timeAxis->maximum() * 1.02);
divedatapoint data = plannerModel->at(index);
data.depth.mm = lrint(profileScene->profileYAxis->valueAt(activeHandler->pos()) / M_OR_FT(1, 1)) * M_OR_FT(1, 1);