subsurface/profile-widget/tankitem.h
Berthold Stoeger d0beae59f9 profile: start with "absolutizing" the profile layout
The chart items were laid out in relative terms with respect
to a fixed scene size (100.0, 100.0). This simply does not
cut it when resizing the chart. Why should the axes always
occupy the same fraction of the chart independent of the size.

Moreover, this led to basically unmaintainable code.

Resize the scene according to the viewport and do
absolute placement of the items. This breaks the layout,
but at least now we have a chance to fix things
somewhat reasonably.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-12-17 11:54:23 -08:00

29 lines
671 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef TANKITEM_H
#define TANKITEM_H
#include "profile-widget/divelineitem.h"
#include "core/gas.h"
#include <QGraphicsRectItem>
#include <QBrush>
struct dive;
class DiveCartesianAxis;
class TankItem : public QGraphicsRectItem
{
public:
explicit TankItem(const DiveCartesianAxis &axis, double dpr);
void setData(const struct plot_info *plotInfo, const struct dive *d);
double height() const;
private:
void createBar(int startTime, int stopTime, struct gasmix gas);
const DiveCartesianAxis &hAxis;
int plotEndTime;
double dpr;
QBrush air, nitrox, oxygen, trimix;
QList<QGraphicsRectItem *> rects;
};
#endif // TANKITEM_H