subsurface/profile-widget/tankitem.h
Berthold Stoeger 360f07e453 Cleanup: pass gasmix by value
In a previous commit, the get_gasmix_* functions were changed to
return by value. For consistency, also pass gasmix by value.

Note that on common 64-bit platforms struct gasmix is the size
of a pointer [2 * 32 bit vs. 64 bit] and therefore uses the
same space on the stack. On 32-bit platforms, the stack use
is probably doubled, but in return a dereference is avoided.

Supporting arbitrary gas-mixes (H2, Ar, ...) will be such an
invasive change that going back to pointers is probably the
least of our worries.

This commit is a step in const-ifying input parameters (passing
by value is the ultimate way of signaling that the input parameter
will not be changed [unless there are references to said parameter]).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-23 05:16:38 -07:00

39 lines
979 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef TANKITEM_H
#define TANKITEM_H
#include <QGraphicsItem>
#include <QModelIndex>
#include <QBrush>
#include "profile-widget/divelineitem.h"
#include "profile-widget/divecartesianaxis.h"
#include "core/dive.h"
class TankItem : public QObject, public QGraphicsRectItem
{
Q_OBJECT
public:
explicit TankItem(QObject *parent = 0);
~TankItem();
void setHorizontalAxis(DiveCartesianAxis *horizontal);
void setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d);
signals:
public slots:
void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
private:
void createBar(qreal x, qreal w, struct gasmix gas);
DivePlotDataModel *dataModel;
DiveCartesianAxis *hAxis;
struct dive diveCylinderStore;
struct plot_data *pInfoEntry;
int pInfoNr;
qreal height;
QBrush air, nitrox, oxygen, trimix;
QList<QGraphicsRectItem *> rects;
};
#endif // TANKITEM_H