profile: improve calculation of the right border

The time axis might need some space and the average depth item
puts a formatted depth at to right of the profile. Consider
these when calculating the right border.

Since I found no way to turn of the average depth, this creates
a permanent border, which might or might not be a good thing.

Contains some refactoring of the label-size functions provided
by DiveTextItem.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-11-13 18:05:31 +01:00 committed by Dirk Hohndel
parent 6b33c3e721
commit 176a62f752
8 changed files with 50 additions and 43 deletions

View file

@ -36,9 +36,7 @@ TankItem::TankItem(const DiveCartesianAxis &axis, double dpr) :
double TankItem::height() const
{
QFont fnt = DiveTextItem::getFont(dpr, 1.0);
QFontMetrics fm(fnt);
return fm.height() + 2.0 * border * dpr;
return DiveTextItem::fontHeight(dpr, 1.0) + 2.0 * border * dpr;
}
void TankItem::createBar(int startTime, int stopTime, struct gasmix gas)