profile: fix y-coordinate of picture thumbnails

When changing from relative to absolute scaling of the char
elements, positioning of the picture thumbnails was broken.

To emulate the old behavior, add a function to DiveCartesianAxis,
that allows positioning with respect to the axis on the screen.

To simplify tuning of the poctuire positions, name a few
constants explicitly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-10-26 09:40:38 +02:00 committed by Dirk Hohndel
parent 51be326879
commit 6cc6fe4d91
3 changed files with 25 additions and 5 deletions

View file

@ -375,6 +375,18 @@ qreal DiveCartesianAxis::posAtValue(qreal value) const
return adjusted;
}
double DiveCartesianAxis::screenPosition(double pos) const
{
QLineF m = line();
double from = position == Position::Bottom ? m.x1() : m.y1();
double to = position == Position::Bottom ? m.x2() : m.y2();
if ((position == Position::Bottom) == inverted)
pos = 1.0 - pos;
return (to - from) * pos + from;
}
double DiveCartesianAxis::maximum() const
{
return max;