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>
This commit is contained in:
Berthold Stoeger 2021-06-03 17:19:38 +02:00 committed by Dirk Hohndel
parent 7744fec0bf
commit 01983c65c3
9 changed files with 88 additions and 98 deletions

View file

@ -13,7 +13,7 @@ class DiveTextItem : public QObject, public QGraphicsItemGroup {
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
DiveTextItem(QGraphicsItem *parent = 0);
DiveTextItem(double printScale, QGraphicsItem *parent = 0);
void setText(const QString &text);
void setAlignment(int alignFlags);
void setScale(double newscale);
@ -21,10 +21,6 @@ public:
const QString &text();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private
slots:
void fontPrintScaleUpdate(double scale);
private:
void updateText();
int internalAlignFlags;
@ -33,7 +29,6 @@ private:
QString internalText;
double printScale;
double scale;
bool connected;
};
#endif // DIVETEXTITEM_H