cleanup: constify TankItem::setData()

The TankItem only displays the data. Pass pointers as const.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-11 18:54:48 +01:00 committed by Dirk Hohndel
parent 84f48b7290
commit 98594c18d1
2 changed files with 4 additions and 4 deletions

View file

@ -61,7 +61,7 @@ void TankItem::createBar(int startTime, int stopTime, struct gasmix gas)
label->setZValue(101); label->setZValue(101);
} }
void TankItem::setData(struct plot_info *plotInfo, struct dive *d) void TankItem::setData(const struct plot_info *plotInfo, const struct dive *d)
{ {
if (!d) if (!d)
return; return;
@ -73,7 +73,7 @@ void TankItem::setData(struct plot_info *plotInfo, struct dive *d)
} }
// Find correct end of the dive plot for correct end of the tankbar. // Find correct end of the dive plot for correct end of the tankbar.
struct plot_data *last_entry = &plotInfo->entry[plotInfo->nr - 1]; const struct plot_data *last_entry = &plotInfo->entry[plotInfo->nr - 1];
plotEndTime = last_entry->sec; plotEndTime = last_entry->sec;
// We don't have enougth data to calculate things, quit. // We don't have enougth data to calculate things, quit.
@ -90,7 +90,7 @@ void TankItem::setData(struct plot_info *plotInfo, struct dive *d)
// get the information directly from the displayed dive // get the information directly from the displayed dive
// (get_dive_dc() always returns a valid dive computer) // (get_dive_dc() always returns a valid dive computer)
struct divecomputer *dc = get_dive_dc(d, dc_number); const struct divecomputer *dc = get_dive_dc_const(d, dc_number);
// start with the first gasmix and at the start of the dive // start with the first gasmix and at the start of the dive
int cyl = explicit_first_cylinder(d, dc); int cyl = explicit_first_cylinder(d, dc);

View file

@ -14,7 +14,7 @@ class TankItem : public QGraphicsRectItem
{ {
public: public:
explicit TankItem(const DiveCartesianAxis &axis); explicit TankItem(const DiveCartesianAxis &axis);
void setData(struct plot_info *plotInfo, struct dive *d); void setData(const struct plot_info *plotInfo, const struct dive *d);
private: private:
void createBar(int startTime, int stopTime, struct gasmix gas); void createBar(int startTime, int stopTime, struct gasmix gas);