subsurface/profile-widget/tankitem.h
Berthold Stoeger 01983c65c3 profile: pass fontPrintScale at construction time
Instead of intializing the text fields and then changing the
font scale via signal-rigmarole, pass down the font-scale
at construction time.

Since the fontPrintScale is only set in print mode, we also
can access it directly instead of testing for printMode.

Since the DiveTextItem is not updated using signals anymore,
the connected flag can be removed.

The commit is larger than I had hoped for, but this makes
things ultimately less brittle.

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

28 lines
669 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 fontPrintScale);
void setData(const struct plot_info *plotInfo, const struct dive *d);
private:
void createBar(int startTime, int stopTime, struct gasmix gas);
const DiveCartesianAxis &hAxis;
int plotEndTime;
double fontPrintScale;
QBrush air, nitrox, oxygen, trimix;
QList<QGraphicsRectItem *> rects;
};
#endif // TANKITEM_H