profile: set axis in constructor of TankItem

There is no point in a separate set-axis function if we never
change the axis anyway. Make the axis a const-reference to
show that it can never be changed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-12-23 12:33:05 +01:00 committed by Dirk Hohndel
parent 47d673bda3
commit 7da5719cab
3 changed files with 7 additions and 15 deletions

View file

@ -7,7 +7,8 @@
static const qreal height = 3.0;
TankItem::TankItem() :
TankItem::TankItem(const DiveCartesianAxis &axis) :
hAxis(axis),
plotEndTime(-1)
{
QColor red(PERSIANRED1);
@ -28,7 +29,6 @@ TankItem::TankItem() :
trimixGradient.setColorAt(1.0, red);
trimix = trimixGradient;
air = blue;
hAxis = nullptr;
}
void TankItem::setData(struct plot_info *plotInfo, struct dive *d)
@ -48,8 +48,8 @@ void TankItem::setData(struct plot_info *plotInfo, struct dive *d)
void TankItem::createBar(int startTime, int stopTime, struct gasmix gas)
{
qreal x = hAxis->posAtValue(startTime);
qreal w = hAxis->posAtValue(stopTime) - hAxis->posAtValue(startTime);
qreal x = hAxis.posAtValue(startTime);
qreal w = hAxis.posAtValue(stopTime) - hAxis.posAtValue(startTime);
// pick the right gradient, size, position and text
QGraphicsRectItem *rect = new QGraphicsRectItem(x, 0, w, height, this);
@ -106,8 +106,3 @@ void TankItem::replot()
}
createBar(startTime, plotEndTime, gasmix);
}
void TankItem::setHorizontalAxis(DiveCartesianAxis *horizontal)
{
hAxis = horizontal;
}